The goal of this patch is to support automatic generation of client-side JavaScript validation in addition to server-side validation.
The high-level design is as follows:
- We introduce reflection for validations so that we can examine what validations have been defined
- We store InstanceTag objects for all fields generated via FormHelper's methods in a @rails_instance_tags attribute of the view
- We provide a JS library with functions for all the supported validation types
- We then generate appropriate JS calls for all fields in our new @rails_instance_tags attribute.
The current patch is just a proof-of-concept and only supports "validates_presence_of" and "validates_length_of with :maximum".
See the HOWTO on instructions on how to play with the patch.