In SurveyCTO forms the first thing you specify about a field is the type of field it is, which limits what type of data it can hold. This is the most basic way of limiting what can be entered into a field. Beyond the data type, you can include more specific limits on what can be entered into a field, which we call "constraints" in SurveyCTO. A constraint is a condition (or expression) that you can set that must be satisfied before a value entered into a field is accepted, and in this way, you can validate responses.
It is important to understand how constraints interact with another more basic field property: whether a field requires an answer. For more on the required field parameter, please read about other field properties. A constraint evaluates the value which is captured in a field. It is possible to pass a field which is not required without recording an answer, which would defeat a constraint as well. So a field being required is an important companion to a constraint.
Getting started
So how can you add a constraint to a field? SurveyCTO has features to help you create constraint expressions. While you're designing a form in the online form designer, when you configure a field, there's the constraint wizard. Or on the Design tab of the server console, under Tools, there's the option to build a constraint.
Let's say you want to build a constraint that limits the range of responses for an integer field in to the possible range of values for legal adults (e.g. 18 to 100). You might also want to include an allowable exception, outside this range, to signify "don't know" (allowable exceptions are discussed further in part 2 of this guide). You can also build such a constraint using the Design tab's constraint builder:
0 Comments