Skip to main content
Participant
September 26, 2018
Question

validate code for multiples

  • September 26, 2018
  • 1 reply
  • 534 views

what is the javascript validation code for multiples of 6.  I have created a fillable order form in acrobat and certain items can only be ordered in multiples of 6. So i want the quantity field to only accept numbers that are divisible by 6.  thanks

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
September 26, 2018

Use this code as the field's custom validation script:

if (Number(event.value)%6!=0) {

    app.alert("You must enter a value that's a multiple of 6.");

    event.rc = false;

}

Participant
September 26, 2018

THANK YOU! 

Inspiring
September 26, 2018

You might want to add checks for a minimum value (e.g., 6, since -18 % 6 = 0) and a maximum as well, and blank.