Hi,
What do I have to override in order to be able to have the error message
of each field in front of the input field?
I haven''t been able to find anything similar on google. All
I''ve found
is how to override the container around the input field.
ActionView::Base.field_error_proc = Proc.new { |html_tag, instance|
"<span
class=\"fieldWithErrors\">#{html_tag}</span>" }
Or in here do we have access of the error message of the current field?
Greg
--
Posted via http://www.ruby-forum.com/.
--
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.
No need to overwrite anything. You can simply access the @resource.errors hash and display the error if there is one... <%= f.label(:author) %> <% if @comment.errors[:author] %> <%= @comment.errors[:author] => <% end %> <% f.text_field(:author, :size=>20, :maxlength=>250) %> -- 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.
Tim Shaffer wrote in post #968409:> No need to overwrite anything. You can simply access the > @resource.errors > hash and display the error if there is one... > > <%= f.label(:author) %> > <% if @comment.errors[:author] %> > <%= @comment.errors[:author] => > <% end %> > <% f.text_field(:author, :size=>20, :maxlength=>250) %>Cool! Thanks! -- Posted via http://www.ruby-forum.com/. -- 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.
I have a problem with my bogus fields no longer highlighted by fieldWithErrors. In the railscasts video it works, but not on my app that I am currently upgrading from 2.x to 3.0. In railscasts Ryan doesn''t have to test manually if the field has an error. Anyone run into this issue? -- Posted via http://www.ruby-forum.com/. -- 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.
My bad I just realized that they switched from camelCase css naming to underscores. I think Rails 3 introduced too many insignificant changes that are a pain in the butt to track. -- Posted via http://www.ruby-forum.com/. -- 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.