How to validate form and highlight accordingly?
Posted on 2008-10-02
How can I create a form which validates an entry when clicking outside of the input field?
I have seen various form validations like SPRY, jvalidate and so on... but had problems with customizing the form and with validation on the fly; i.e. the form begins to validate as soon as the user begins to type - this could be confusing to the user since he might be getting an error as soon as he starts typing. One other typical function I did not like with these libraries is that some of them when you clear a field and click outside of the input field they request you to fill it in. A user might want to skip a field and go for that later - so I basically need something that if a required field is missing, it will be checked once the user clicks the submit button not when the user clicks outside of an input field.
So a summary would be a form that:
- validate fields when clicking outside the field (hightlight green when correct and hightlight red+error message when there is an error), having field length > 0.
- if field is required and field length < 0, check on submit
- flexible customization of form user interface
Let me know if you need any clarifications.