Forums

VALIDATION RULES

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
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.