Hi Nelson,
First off I would recommend that you don't delete script from inside the XML Source. Yes, it can be done, but could easily break your form, potentially beyond repair.
If you select the root node (form1) and go to the script editor. Then from the Show dropdown select ValidationState, you can quickly scroll down and find the object with script in that event. I suspect that it is in the form1 node anyway.
My experience is that when you deselect the colour mandatory fields in the form properties, that LC Designer deletes the auto generated code. If you amended the code beforehand, it may fail to detect it and not remove it.
In relation to v9 and below there are a number of ways to handle validation - so it is do-able, but not as straightforward as v9.1. I would recommend John Brinkman's blog, as he has some samples of heavily (but elegantly) coded 'show errors' forms. http://blogs.adobe.com/formfeed/. Search for 'validation'.
The standard Submit buttons will pick up if a required field is null and automatically highlight it in red. However for fields that are required and have a value OR fields that are not required and have an invalid value, LC/Acrobat will not highlight these in red.
Out-of-the-box validation will give you an error message if the value is invalid. This happens on exiting the field and on submit - no colouring. You can add a line of code to other buttons (like Print) or in the prePrint event, to validate before they execute their own script:
form1.execValidate();
You would wrap it as a test in an if statement, so that the form would only print if the data was valid.
So:
- lowest solution, individual validation on specific objects, means lots of alerts, which the user can ignore and no colour highlighting.
- Follow John Brinkman's solutions for custom functions to handle validation.
- Users upgrade to v9.1.
I hope that helps,
Niall