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

Validate event runs on load, does not prevent edit next field

cl5792
Registered: Jul 17 2008
Posts: 53

I have a couple of problems with the validate event in a form. I have this event script on the subform. It validates correctly.

(this.Q14Total == 100);

1. The validation script runs when the form is loaded and of course fails because there is not any data entered.

2. Once in the subform (which is a series of text boxes that are added into a total box as values are entered). If you click out of the form, say to a radio button, and the validation fails the radio button still changes value if it was not "on" before. How can I prevent changing another control when the validation fails?

Thanks,

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The root event that's causing the validation to take place is the Mouse Down on the radio button. This action immediately causes a chain of events that lead to the validation script. The event that's causing the radio button to change is the mouseUp. Things are happening pretty quick here. I don't know if it's possible, but you could try changing the keyboard focus before the user releases the mouse button so that the radio button never recieves it.

Start by placing console.println statements in all the relevant event scripts and watch the console window as they occur to get a good feel for how it all works. Try clicking fast and slow to look for changes in event ordering. Then put a setFocus call into the validate to see what happens.

Personally I don't think there's a thing you can do to stop someing like a radio button from being clicked. There are too many complex overlapping events and there are lots of timing issues that could cause even bigger problems. But it's worth a try to check it out. And it's a great learning experience.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script