I'm developing with ruby 1.9.2 and rails 3.2.2. Currently I want to customize 
the error message html, to place the error message below a text area. But what 
it behaves is two message box around the text area. Do you know where the 
problem is? Thanks.

ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
  errors = instance.error_message
  errors_list = "<ul>" + errors.map { |e| "<li>#{e}</li>" }.join + "</ul>"
  %(#{html_tag}<section 
class="validation-error"><h2>Errors</h2>#{errors_list}</section>).html_safe
end

<section class='field' id='content'>
    <label for="script_content">Content</label>
    <section class="validation-error"><h2>Errors</h2><ul><li>can't be 
blank</li></ul></section>
    <br>
    <textarea cols="40" id="script_content" name="script[content]" 
rows="20"></textarea>
    <section class="validation-error"><h2>Errors</h2><ul><li>can't be 
blank</li></ul></section>
</section>

Best regards,
Zhi-Qiang Lei
[email protected]

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to