Right now I have my ActionView::Base.field_error_proc as
Proc.new do |html_tag, instance|
if html_tag =~ /^<label/ or instance.respond_to?(:object_name)
%{<div class="field_with_errors">#{html_tag}</div>}.html_safe
else
%{<div class="field_with_errors">#{html_tag}<br /><label for="#{instance.send(:tag_id)}" class="message">#{instance.error_message.first}</label></div>}.html_safe
end
I had modified this to accomodate a few of my needs when i did use the client_side_validations gems.
Right now, the 'fields_with_error' div wraps around the html_tag(i.e the error field to be specific). What i would like to know though is if its possible to modify the position of the div class="fields_with_error" and place it right after the div that contains the error_field.
For eg,
<div class="main_div">
<%= password_field_tag 'secret', 'Your secret here' %>
</div>
Then the div class="fields_with_error" should be postioned as
<div class="main_div">
<%= password_field_tag 'secret', 'Your secret here' %>
</div>
<div class="fields_with_error"> <label class="message"> The error message </label> </div>
Any help would be of great value.