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

Custom Validation through JS?

ladydev
Registered: Jun 10 2011
Posts: 3
Answered

First of all, I want to thank everyone in this community as you've been invaluable to my new Acrobat education in the past week. I had no idea how much you could do with this program.
 
Anywho. I've created a form and am finally putting some finishing touches with validation.
 
MY QUESTION: Is there a way to validate a form field NOT through the Properties window?
 
I have a set of form fields that are dynamic based on a radio button selection. For instance if the payment type is set to Credit Card, they'll ask for CC #, Type, etc. But if they chose ACH, it'll ask for Bank Name, Routing #, etc.
 
Since these are dynamic, I'd like to dynamically validate them dependent on which data is actually selected. I wouldn't want to put a CC validation script on a Bank Name, nor would I want to put a Expiration Date validation script on an Account Type.
 
Is this possible by means of some other type function I can use in the Document Javascripts?
 
Thanks in advance.

My Product Information:
Acrobat Pro 9.4.3, Macintosh
try67
Expert
Registered: Oct 30 2008
Posts: 2398
So you don't want to use a script to do this? Why not?

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

ladydev
Registered: Jun 10 2011
Posts: 3
No, I want to use a script. You might say I ONLY want to use a script.

I just wonder if I can dynamically set the validation on a text field without having to set it through a form field's Validation tab in the Properties window.
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Accepted Answer
Oh, OK.
Of course you can do it with a custom validation script.
You need to first check the value of the radio button and then make your validation.

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

ladydev
Registered: Jun 10 2011
Posts: 3
I was about to write that I didn't think we were understanding one another until I realized: DUH! Of course. Put the conditional in the Custom Validation Script.

Thanks for helping me see my ignorance.