donderdag 7 juni 2007

client side validation

I was looking for a good validation framework. Some options:

I eventually used jsVal. The inline form initialisation is very easy in use. Regex are supported and some specific validations can be done with callback functions.

Errorfields are marked by defining a css class. Besides that a popup shows a more informative message. These can be translated using javascript.

Custom validation messages can be defined using the err="your message" attribute. Only works in validateStandard() mode. The validateCompleteForm() mode in which all fields are validation in once seems to ignore these personal messages.

When using callback you need to set required="1".

I used a little trick to validate multiple fields (like compare a to be) by adding an onclick="return moreValidation()" event to the submit button.

To end this post an article about a more complex solution. Uses server side validation icw ajax to simulate (towards user) client side validation.

Geen opmerkingen:

Een reactie plaatsen