Validating a value in a field

lpowlette 02 Apr, 2015
Hello,

I am trying to validate the value in a field but it is proving difficult and I cannot see why.

I have a form with a field where I want the user to enter a value but the minimum value should be 20.00. How can I get the form to validate that the value entered is not less that 20.00?

Luther
GreyHead 07 Apr, 2015
Answer
Hi Luther,

In the text input settings Validation tab add a Custom validation function e.g. checkMin. I also set the Mask to Integer.

In the Setup tab add a Load JavaScript action to the On Load event and add this code:
function checkMin(el) {
  return ( el.val() >= 20 ); 
}
That seems to work OK.

You may also want to add a custom validation error message using the Title box.

Bob
lpowlette 07 Apr, 2015
Hi Bob,

That's great. Works a treat.

Thanks

Luther
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger