Sunday, June 14, 2009

Easy Field Validation with Prototype

Giving validations in rails applications is really simple and nice, but if we can display validations with cool javascript effect, the application really looks effective.

This is possible with using prototype library and adding validations.js by Andrew Tetlaw. You can find documentation and demo.

The code really works fine and with really nice effects. If any one wants to add image, can alter the code little bit and change the validation div to the span in javascript itself and add image_tag. We can also add our own validations.

Only problem occurs when using calendar_date_select plugin and error hits. calendar_date_select link stops working.
If not using calendar_date_select these validations rocks. I will definitely prefer to use these.

No comments:

Post a Comment