We created a fillable form with some validation rule coded in Exit event of some of the text boxes. We tried the following steps:
1. opened the pdf in internet explore
2. filled the form and triggered the warning messagebox (say entered an invalid date)
3. click OK on the message box. (in this case, our code set the focus back the the textbox which didn't pass the validation rule)
4. close the pdf file.
Then, we found the warning message showed up again twice(totally 3 times). But if we open the file in Reader, it only shows up once when we try to close the pdf file. Can anyone tell me how to aviod this?
Thanks!
The problem with the multiple message boxes is likely the fact that your script shows a message box. The Exit event occurs on loss of focus to the date field. If the input cursor is in the date field when the form is closed, this would trigger a loss of focus on the date field which would trigger your message box since there's still an invalid value in the date field.
I would suggest performing validations at a later time rather than on a field-by-field basis. That way, you avoid this kind of trouble. See my [url=http://forms.stefcameron.com/2006/08/15/invalid-flashing-fields-20/]Invalid Flashing Fields tutorial[/url] for an example.
Stefan Cameron obtained his bachelor's degree with Honors in Computer Science at the University of Ottawa and is a Computer Scientist working on Adobe's LiveCycle server products, in particular on LiveCycle Designer ES for the past 5 years.