Check if error_messages_for contains special error

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

On 5/13/08, Kim Q. [email protected] 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 D.
http://destiney.com/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs