...
Code Block |
---|
|
valid = (input.length < 250) ? true : "Maximum character length reached."; |
Examples
The below code can be used to ensure the value entered into a text field matches that of another control. For example, in some cases, you may want to make sure a typed signature matches the name of an employee who is submitting a form.
Code Block |
---|
language | js |
---|
title | Custom Validation Rule |
---|
|
valid = (input == data.EmployeeName) ? true : 'Please type your name as shown in the Employee Name field.' |
The above code, when entered in Validation > Custom Validation will ensure the value entered in the field is equal to value of the control "data.EmployeeName". If in the event it is not, it will present the error "Please type your name as shown in the Employee Name Field."
You can use standard javascript logic when deciding your conditions for validation. In the below example, we only allow values greater then 100, but less then 500.
Code Block |
---|
language | js |
---|
title | Custom Validation Rule |
---|
|
valid = (input > 100 && input < 500) ? true : 'Please enter a value between 100 and 500.' |