• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

validate code for multiples

New Here ,
Sep 26, 2018 Sep 26, 2018

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

TOPICS
Acrobat SDK and JavaScript

Views

126

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
Community Expert ,
Sep 26, 2018 Sep 26, 2018

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;

}

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 ,
Sep 26, 2018 Sep 26, 2018

Copy link to clipboard

Copied

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
LEGEND ,
Sep 26, 2018 Sep 26, 2018

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.

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
Community Expert ,
Sep 26, 2018 Sep 26, 2018

Copy link to clipboard

Copied

LATEST

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.

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