OK, I find it. html_tag includes the labels.
On Mar 14, 2012, at 6:32 PM, Zhi-Qiang Lei wrote:
> 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
> zhiqiang.lei-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>
Best regards,
Zhi-Qiang Lei
zhiqiang.lei-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
--
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.