Quantcast
Channel: Ruby / Rails – James Crisp
Viewing all articles
Browse latest Browse all 62

Rails: Removing error divs around labels

$
0
0

Rails makes it very easy to style fields with errors on your form. Unfortunately, the same error DIV with class ‘.field_with_errors’ is applied around labels, as well as inputs/checkboxes/selects. This tends to mess up the layout and double up on error display. To fix this, you can configure the field_error_proc in your application.rb to ignore labels. The code below calls the original error decoration proc for all types of tags except for labels.


Viewing all articles
Browse latest Browse all 62

Trending Articles