Hi, im realy new to ror, so my question may be stupid: in the controller I check if a person who wants to register ist older than 18 years. If the person isn''t I add an error with errors.add_to_base($USER_ERROR_VOLLJAEHRIG). I''m having trouble with the validation of each select field that is provided by date_select, because I can''t get each selectfield red if it is empty. So I thought to put the background of the div that contains the date-select-fields into red. How can I check if error_messages_for contains the message that I addes with errors.add_to_base? Think this is not a nice way. Maby you hav an other solution? thanks in advance -- 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-/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 -~----------~----~----~----~------~----~------~--~---
On 5/13/08, Kim Quermann <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > in the controller I check if a person who wants to register ist older > than 18 years. If the person isn''t I add an error with > errors.add_to_base($USER_ERROR_VOLLJAEHRIG). > I''m having trouble with the validation of each select field that is > provided by date_select, because I can''t get each selectfield red if it > is empty.You only need to make a validation in the model for the date field. Rails handles the fact that date_select is seperate fields in the view. validates_presence_of :my_date> So I thought to put the background of the div that contains the > date-select-fields into red. How can I check if error_messages_for > contains the message that I addes with errors.add_to_base? > Think this is not a nice way. Maby you hav an other solution?I''ve never use add_to_base myself, I always want the error to be associated with the field that caused it. -- Greg Donald http://destiney.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-/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 -~----------~----~----~----~------~----~------~--~---