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

New Here ,
Mar 10, 2018 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!

TOPICS
Acrobat SDK and JavaScript, Windows

Views

73

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
community guidelines

correct answers 1 Correct Answer

Most Valuable Participant , Mar 10, 2018 Mar 10, 2018
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
Most Valuable Participant ,
Mar 10, 2018 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
community guidelines
New Here ,
Mar 10, 2018 Mar 10, 2018

Copy link to clipboard

Copied

LATEST

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
community guidelines