Skip to main content
Spartaneity
Participant
Mar 10, 2018 7:48 PM UTC
Answered

check/force multiple of 10 for entry in a form field

Trying to set up a form field that only accepts multiples of 10 by using custom validation script.

I tried this without success...

Math.ceil(event.value / 10) * 10;

I'm a newbie at this so any help is appreciated.

Thanks!

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Mar 10, 2018 8:45 PM UTC

Use this as the field's custom validation script:

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

    app.alert("You must enter a multiple of 10.");

    event.rc = false;

}

2 replies

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Mar 10, 2018 8:45 PM UTC

Use this as the field's custom validation script:

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

    app.alert("You must enter a multiple of 10.");

    event.rc = false;

}

Translate
Spartaneity
Participant
Mar 10, 2018 10:09 PM UTC

Thanks for the quick reply - it works perfectly!

Thank you!

Translate