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

XFA Form Field Vaildate Event Processing

csearl
Registered: Aug 10 2006
Posts: 28

I'm trying to call a javascript function in the validate event of a field in an XFA form. Actually, there are about ten fields with the same validation script. When the validate event fires, my form becomes unresponsive.
 
There seems to be some rules that require you to be very careful when writing validate event scripts.
 
I have read that even referencing a field can cause subsequent validate events to fire, even if the values don't change.
 
Do you know where I can get more information that describes, in detail, exactly how XFA validate events are triggered? I've read nothing about this in the Adobe documentation. The Adobe document provides no sample validate scripts either.
 
What I need is for the form to stop processing when it finds an invalid field (using the script's logic) and set the focus on that field. Is that even possible?
 
Thank you in advance.

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Here's what you do. Place the following line, and only the following line each of the event scripts that you want to use.

console.println("Field: " + this.name + " Event: " + xfa.event.name);

Save and try out your form. You'll see each event reported in the Acrobat JavaScript Console.

Now add in some, but not all, of your most suspicious code and try the form again. You'll see exactly how these events are being hit.

More than likely your code is causing re-entrant behaviour. The console.println statments will show how this is happening.

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

csearl
Registered: Aug 10 2006
Posts: 28
Thanks Thom, I'll try that.

I still need some sample code or a good programmer's reference for the XFA form's validate event. I want Acrobat to stop processing and set the focus on the invalid field, so I really need some sample javascript(s) for a typical field validation. The only javascript I could find changed the display attributes of the field. Not something I would first think of for a "validate" event, so the documentation is not that helpful here. :(
csearl
Registered: Aug 10 2006
Posts: 28
Thom,
Will that code work with an XFA form?