Highlighted

Script ofr Length of field

New Here ,
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, PDF forms

Views

111

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

Script ofr Length of field

New Here ,
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, PDF forms

Views

112

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
Most Valuable Participant ,
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.

 

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...
JMC08 LATEST
Community Beginner ,
Jun 22, 2020

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
Reply
Loading...
New Here ,
Apr 11, 2020

Copy link to clipboard

Copied

Thank you very much 

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...
Resources
One Stop Solution for Acrobat
Edit a PDF