What are Form rules?
Form rules are essentially value rules: principles you define regarding what data may be entered in your form and what data may not.There are two types of Value rules: field value rules and form value rules (aka Form rules). The two have the same concept only they are applied to different levels of the form. The first (field value rule) is applied to a specific field in the form while the second (Form rule) is applied to a few fields in the form.
If, for example you have a few phone fields in your form and you wish for the user to enter at least one - you can do so using the form value rule.
Another example is, if you have two textboxes in your form and you want the user to enter different data in them. You can make sure the content is not the same using the form value rule.
A third example of a form rule is defining that the number entered in the "Parent Age" field should be greater than the number entered in the "Child Age" field. In this case, if the form filler will enter a greater child's age he will not be able to submit the form until a the value complies with the form rule.
Following are steps to add a form rule to your form:
1- | Create a new blank form |
2- | Drag one textbox, change its label to: Name |
3- | drag two textboxes. Change their labels to: Phone1 and Phone2 |
4- |
Go to "Properties" panel > "Form" tab > "Settings" > "On submit" category > Form Rules |
5- |
Press on the "Set Rules" button |
6- | Set your rule: - choose “Phone1” in the first dropdown. - Choose "custom" in the next dropdown - A “Configure” button will appear - press on it |
7- |
Enter the following code: if(fieldValues.fld2 == "" && fieldValues.fld4 == "") { isValid = false; } |
8- |
Press “apply” and save the form. |
9- | Publish the form as URL to test it. Try pressing on "Submit" without entering anything in the phone fields. You will not be able to submit the form until at least one phone number is entered. |