I've created a form in Acrobat Pro 9 with some javascript. It has a submit button to send the form. There's a second button to allow the recipient to send a reciept. When the form is opened, the first button is enabled and border changed to red to direct the user to select it. The second button is read only.
I want to change the first to read only / grey border and the second to red border when the user selects the first button. However I'm stuggling to determine the script to use since selecting the first button with out completing all required fields will still allow this action to take place. I need to be able to condition the changes in buttons 1 & 2 on weahter all requeired fields have been completed.
I tried the following code but it didn't work.
if (this.execValidate()== true) {
this.getField('Button2').textColor=["RGB", 0, 0, 0];
this.getField('Button2').borderColor=["RGB", 255, 0, 0];
this.getField('Button2').readonly=false;
this.getField('Button1').textColor=["RGB", .5, .5, .5];
this.getField('Button1').borderColor=["RGB", .5, .5, .5];
this.getField('Button1').readonly=true;
}
Please let me know how to accomlish this?
Thanks,
Acrojack
BTW: the "execValidate()" function is a LiveCycle scripting function. The rest of the script is written for an AcroForm.
If you search for validate on this site you'll find loads of helpful information.
Here's a short article that discusses the issue: Form Data Validation
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script