In my User form I have standard field to get user record attributes (first_name, last_name and email) I also have a select drop_down to choose a role from an array first_name, last_name and email are user record attributes, but I defined the role name as a virtual attribute validates_presence_of :email, :last_name attr_accessor :role_name validates_presence_of :role_name, :if => :role_name_required?, :message => ''must be selected'' when testing with a blank form, I get all errors detected during User model validation, which is fine... BUT ActionView::Base.field_error_proc doesn''t get the role_name error, so I cannot change the style of the select I checked it , debugging the proc : ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| debugger .. I just get the html_tag for email and last_name, never for role_name ... what''s wrong ? thanks for your lights .. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
In my User form I have standard field to get user record attributes (first_name, last_name and email) I also have a select drop_down to choose a role from an array first_name, last_name and email are user record attributes, but I defined the role name as a virtual attribute validates_presence_of :email, :last_name attr_accessor :role_name validates_presence_of :role_name, :if => :role_name_required?, :message => ''must be selected'' when testing with a blank form, I get all errors detected during User model validation, which is fine... BUT ActionView::Base.field_error_proc doesn''t get the role_name error, so I cannot change the style of the select I checked it , debugging the proc : ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| debugger .. I just get the html_tag for email and last_name, never for role_name ... what''s wrong ? thanks for your lights .. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Seemingly Similar Threads
- TIP: Using field_error_proc to add style attributes to form elements
- How do i switch off error wrapping for a specific field?
- validation error messages in Form - how to disable the ActionView::Base.field_error_proc ?
- Overriding <div class="fieldWithErrors">
- field_with_errors.