Custom Field Error plugin

Plugin details

custom_field_error allows you to easily setup custom HTML to be displayed when there is a validation issue with a form.

Websitehttp://code.google.com/p/custom-field-error/ Repositoryhttp://custom-field-error.googlecode.com/svn/trunk/ Author Michael Boutros Tags HTML, validation LicenseUnknown

Documentation

Install the plugin:
ruby script/plugin install http://custom-field-error.googlecode.com/svn/trunk/

It sounds like a lot, but it's actually very simple. Just put the following line in your model, in this case a User model:

custom_field_error "< span id='error'>?< /div>"


Now, if there was an error on a field called "name" in a form, it would look like:

< span id='error'>< input id="user_name" name="user[name]" size="30" type="text" value="" />< /span>


However, this custom view would only be for the User view. To make this view the default view, simply set the second argument to 'default':

custom_field_error "< span id='error'>?< /div>", 'default'


However, what if I now want to set a special view for my Project model? Simple. Just set custom_field_error like usual and it'll override the default view:

custom_field_error "< span id='project_error'>?< /span>"


Voila! The plugin will automatically figure out what view it needs to display and display it.

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | (0 older versions) | Last edited by: hardway, 9 months ago