开发者

Formtastic change style of input boxes on validation errors

开发者 https://www.devze.com 2023-02-21 05:59 出处:网络
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

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; }
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号