search for: error_style

Displaying 2 results from an estimated 2 matches for "error_style".

Did you mean: error_state
2006 Jan 19
5
TIP: Using field_error_proc to add style attributes to form elements
...useful to anyone else. This is handy if you don?t want to wrap your input elements inside a div when an error occurs, but instead want to add some sort of CSS style to fields with errors: ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| msg = instance.error_message error_style = "background-color: #f2afaf" if html_tag =~ /<(input|textarea|select)[^>]+style=/ style_attribute = html_tag =~ /style=[''"]/ html_tag.insert(style_attribute + 7, "#{error_style}; ") elsif html_tag =~ /<(input|textarea|select)/ first_w...
2006 Feb 24
5
Changing default behavior of fieldWithErrors
Hi! The topic can be a bit misleading, because it may suggest that i want to change css style. What i''d like to change is that normally, when there''s an error, rails creates a div element with the fieldWithErrors class as the parent of the input. I''d like to change this behavior, so the input element itself will have this class added to its current classes and