Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
docassemble/docassemble_demo/docassemble/demo/data/questions/examples/validation-code.yml
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
26 lines (26 sloc)
625 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
metadata: | |
title: Input validation | |
short title: Valid | |
documentation: "https://docassemble.org/docs/fields#input validation" | |
example start: 2 | |
example end: 2 | |
--- | |
mandatory: True | |
question: | | |
There were ${ number_of_apples } | |
apples and ${ number_of_oranges } | |
oranges. | |
--- | |
question: | | |
There are 10 fruit in all. | |
subquestion: | | |
How many apples and oranges | |
are there? | |
fields: | |
- Apples: number_of_apples | |
datatype: integer | |
- Oranges: number_of_oranges | |
datatype: integer | |
validation code: | | |
if number_of_oranges + number_of_apples != 10: | |
validation_error("The number of fruit must add up to 10!") |