Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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;
}
Copy link to clipboard
Copied
THANK YOU!
Copy link to clipboard
Copied
You might want to add checks for a minimum value (e.g., 6, since -18 % 6 = 0) and a maximum as well, and blank.
Copy link to clipboard
Copied
Good point, although the code above will accept blank values.
If the list of possible allowed items is quite limited I would recommend using a drop-down, instead of a text field.