Questions Menu - Validate on Constant Sum
The Validate on Constant Sum function puts custom validation onto the page that adds the sum of several write-in number fields. This function can be applied the maximum of once per page of the survey.
- Select any one of the questions you are working with. Select Questions Validate on constant sum.
- You will see a list of the write-in number questions. Select the questions you want to include in your sum.
- Enter the minimum and maximum values.
- Press Save when you are done.
- To remove the function, select Yes from Do you want to remove this from the form?
And example of a question set that would use this features might be:
The minimum and maximum values would be set to 100 for this example. When the online user enters their values, they will only be able to continue when the sum of the three add up to 100.
- What percent of your day do you spend sleeping?
- What percent of your day do you spend at work?
- What percent of your day do spend doing other?
The validate on constant sum feature finds the sum of a group of write-in number questions and determines whether the user may or may not continue. This feature works on multiple pages but only once per page. (A custom script can be written for multiple validation groups on one page.)
- Create a survey with several write-in number questions. On the this sample, we have three pages with 4 write-in number questions on page one and page two; page three is the end page. We are going to be validating A, B, C, and D in a group on page one and E, F, G, and H in a group on page two.
- Select one of the write-in numbers in the first group.
- Then select Validate on constant sum, the Validate on Sum window will open and it will show all of the write-in questions on the selected page. In this case, we have A, B, C, and D. The window also has the minimum and maximum accepted values option. These values indicate the numeric range by which the selected questions can sum to.
- In this sample I want all of the write in questions to be in my group and I want the sum to add up to 100. Press Save.
- The Section break for the page will be updated with a warning text that will show only when the userís answers don't add up to our value. This text can be put anywhere on the page. Also, the validation file has been updated to calculate the total sum of this group
Setup Validate on constant sum for page two
- Select one of the write-in questions on the second page. Select the Validate on constant sum option.
- On this page we are selecting all of the questions to be in the group and we are setting the minimum accepted value to 3 and the maximum accepted value to 5. Press Save.
Seeing the results
- After you publish the form, enter some numbers into the write-in number fields. In this case we entered 99, 0, 0, and 0 to show you that when Next is pressed, an error shows on the screen. By default the error will say: The sum must be between [min] AND [max]. This message can be changed to say anything and may be put anywhere on the page.
- The second page is similar to the first page except that the acceptable sum is different. On this page we specified three as the minimum accepted value and five as the max. The sum of the numbers in the fields must add up to between three and five.
Removing the group from a page
- Select a write in number question on the page you want to remove it from
- Unselect all of the questions and remove the entries from the minimum accepted value option and maximum accepted value option and select Yes for the option Do you want to remove this from the form? Press Save.