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

New Here ,
Mar 10, 2018

Copy link to clipboard

Copied

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!

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

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;

}

TOPICS
Acrobat SDK and JavaScript, Windows

Views

68

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

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

New Here ,
Mar 10, 2018

Copy link to clipboard

Copied

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!

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

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;

}

TOPICS
Acrobat SDK and JavaScript, Windows

Views

69

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Mar 10, 2018 0
Most Valuable Participant ,
Mar 10, 2018

Copy link to clipboard

Copied

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;

}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 10, 2018 2
New Here ,
Mar 10, 2018

Copy link to clipboard

Copied

Thanks for the quick reply - it works perfectly!

Thank you!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 10, 2018 0