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

Script ofr Length of field

New Here ,
Apr 10, 2020 Apr 10, 2020

Copy link to clipboard

Copied

I am new to this so I could use some help

 

I am trying to get the length of a field and if the field <>  9 product an error. like "your field has to be 9 charectors.

I have been searching and I can not find anything.

 

TOPICS
Acrobat SDK and JavaScript

Views

284

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 ,
Apr 11, 2020 Apr 11, 2020

Copy link to clipboard

Copied

As the custom validation event of the field enter the following (I'm assuming you want to allow the user to clear the field):

 

if (event.value.length!=0 && event.value.length!=9) {
app.alert("You must enter 9 characters.");
event.rc = false;
}

 

Edit: Code fixed.

 

Votes

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 Beginner ,
Jun 22, 2020 Jun 22, 2020

Copy link to clipboard

Copied

LATEST

thank you

Votes

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 ,
Apr 11, 2020 Apr 11, 2020

Copy link to clipboard

Copied

Thank you very much 

Votes

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