VALIDATION RULES

Validate form fields to be greater or less than a specific value.

Overview

The issue is that standard validation rules in CF do not directly support numeric comparisons like greater than or less than.
Create a custom validation rule by defining it in the Validation Rules tab and then implementing the corresponding JavaScript function to perform the numeric check.

Answered
ChronoForms v6
at atanunu 27 Aug, 2017
Please, I want to validate some field to ensure they are GREATER THAN A VALUE or LESSER THAN A VALUE. How can it be achieved


field/>10:Field must be greater than 10
field/<10:Field must be lesser than 10
fl flashfs 28 Aug, 2017
Answer
2 Likes
You could write on Validation rules something like:
isGreaterthan10:Field must be greater than 10


Then add a Javascript and write:
jQuery.fn.form.settings.rules.isGreaterThan10 = function(value) {
  if (value <= 10) {
    return false; // you should return false so the error shows up
  }
  return true; // true will not show the error
}
This topic is locked and no more replies can be posted.