Highlighted

How to find out if a pattern validation failed

_Edgar_van_Waar

23-02-2009

Hello,



I have Designed a form with several pattern-validations on it. LC's default behavior on such validation is that a message will be shown, but the user is still allowed to leave the field. Even if the entered data is crap.



So is it there any way to clear the field after a validation error or enforce the user to go back to the field?



I know it it possible to mark the validation as an error, so submitting will refuse. But in my case I have a custom submitting procedure, so this won't work.



Thanks for your help.

Replies

Highlighted

JohnBrinkman

25-02-2009

Edgar:



Instead of using a validation picture, you could put the logic in a FormCalc validation script and use the format() method. Then if it fails you can clear the field and setFocus() back into the field.



Alternatively, you could use a display picture and your validation script could compare rawValue with formattedValue. If a display picture fails, then rawValue and formattedValue will be the same.

I've described this in more detail (with a sample) at:



http://blogs.adobe.com/formfeed/2009/02/calling_formcalc_functions_fro.html



John Brinkman