Value Rules

Last updated Dec 07 2017
What are value rules?
Value rules are principles you define regarding what data may be entered in a field and what data may not.
An example of a value rule is defining that the number entered in the "Age" field is greater than 18.  In this case, if the form filler will enter "17", an error indicator will appear beneath the element saying the age must be greater than 18, and the form filler will not be able to submit the form until a the value complies with the field rule.

Following are steps to add a value rule to your fields:

1- Enter your form in the form builder
2- Select the field you would like to add a rule to (in the image below the name field is chosen)
3- Go to "Properties" panel > "Element" tab > "Value Rule" category

4-

Press on the "Set Value Rules" button
5-

Configure your rule: Choose the relevant option from the dropdown. The options include simple rules like "Contains", "Not Contains", "Starts with", "Max length" etc.
They also contain ready-made rules that do not require you to set a value. like: Israel ID or US SSN.
You can also choose the REGEX option and enter an expression, like :  /^[a-zA-Z]*$/  -  to have the user fill in only Alphabetic characters.
Read more about validation with REGEX

For full control on validation you can use the custom option to use javascript validation. For example, the following code will validate IBAN account numbers from the UK:

var fieldData = fieldValues.fld3.toUpperCase();
var data = fieldData.replace(/^(.{4})(.*)$/,"$2$1"); //Move the first 4 chars from left to the right
data = data.replace(/[A-Z]/g,function($e){return $e.charCodeAt(0) - 'A'.charCodeAt(0) + 10}); //Convert A-Z to 10-25
var $sum = 0;
var $ei = 1; //First exponent
for(var $i = data.length - 1; $i >= 0; $i--){
$sum += $ei * parseInt(data.charAt($i),10); //multiply the digit by it's exponent
$ei = ($ei * 10) % 97; //compute next base 10 exponent in modulus 97
};
if($sum % 97 != 1) {
return false;
}

isValid = /^GB\d{2}[A-Z]{4}\d{14}$/i.test(fieldData)


Another example: in the image below you can see that the rule states the "name" field must contain "John".
Setting this rule will not allow the form filler to submit the form unless the "Name" field consists of "John".

 
CommentsLogin Required
Didn’t find what you were looking for?
Try the following for assistance or Use the Search box.