These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

validating form fields of a pdf

renegades
Registered: Jul 6 2010
Posts: 26

Hello everyone, I'm an ignorant newbie here ate the forum! ;-)

I just learnt how to apply some different javascript to calculate form fields - all by browsing through this forum only and must say ... WOW - what quality answers you get here! !!!

My BIG Thanks goes to all the experts on this forum who take their time provide all the answers! It's great to see!

Now, I am not a java expert at all, forgive me for my ignorance, but I set up a pdf that includes some fields which I'd like to have validated against the input. I was looking through this forum and also "Binged" a lot (am a Bing fan, yep) but could not find any hints on how to achieve that.

Basically, I'd like to input, where it says "validate >> run custom validation script >> edit" some custom scripts that would then allow only certain input. Like;

field 1: Date
field 2: A sequence of 4-6 letters followed by 4 numbers
field 3: numbers only
field 4: email
field 5: sequence of 8 numbers separated by a hyphen in the middle

Is this possible at all?

Thank you very much
Mitch

My Product Information:
Acrobat Pro 9.2, Macintosh
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Yes. You should look into Regular Expressions. They can be used to match a string to a pre-defined set of rules, similar to the ones you described.
Have a look here, for example:
[url]https://developer.mozilla.org/en/core_javascript_1.5_guide/regular_expressions[/url]

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

renegades
Registered: Jul 6 2010
Posts: 26
Thank you try67

The first link is a good learning tool but it does not give me the answers, really, especially since all is geared towards using regex in website(forms). I, however, need to input some java into the PDF file edit box where you are suppose to add extra javascripts to make any PDF file field act accordingly.

Unfortunately, I could not open the second link and I tried 5 different browsers.

Thank you
try67
Expert
Registered: Oct 30 2008
Posts: 2398
The basic concept of using RegExps is the same, no matter where you use it. The only difference is that in an Acrobat form you acquire the string and return the answer in a different way to a website, but the validation part is the same.

And I only provided one link...

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

renegades
Registered: Jul 6 2010
Posts: 26
try67 wrote:
And I only provided one link...
http://try67.blogspot.com doesn't open! ;-)
try67
Expert
Registered: Oct 30 2008
Posts: 2398
That's my blog, and it does open (for me, at least).

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com