Formtastic change style of input boxes on validation errors
I am using the formtastic gem to generate the forms for my project. Rather than display 开发者_JAVA百科an inline error I would prefer to change the style of the input boxes. Does anyone know of a way to do this?
You should be able to achieve this with just css. Formtastic has an "error" class. You can change the style of inputs inside this class:
form.formtastic fieldset > ol > li.error input{ /** your style here **/ }
Then you can change the style of the inline-errors class to display none:
form.formtastic fieldset > ol > li p.inline-errors{ display:none; }
精彩评论