You''ll need to write a custom validation, I think, if you want to
highlight more than 1 field for a given condition.
if end_time < start_time
errors.add :start_time, ''your message here''
errors.add :start_time, ''your message here''
end
What I have never tried is to hightlight a field without a message so,
in your case, having a unique error message (and no extra empty lines
in the messages section) but 2 fields highlighted at the same time.
On Apr 20, 1:32 am, dan
<mr.dan.ma...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> im tracking events which have a few groups of related data, like
> dates, times and tickets.
> the issue im running into is when multiple forms make up one piece of
> validation:
> ex: if this is checked, these fields need to be present and one needs
> to be greater than the other...
> if one of these things is not right, id like to change two label type
> fields where these input fields are grouped.
>
> im guessing i cannot use the built in validation tools to handle these
> errors, since it only seems to want to highlight the label and field
> in question.
> are there any good examples of how to group input elements and handle
> errors so that one error highlights all relevant fields?
>
> for example, if the end time is before the start time, i want to
> highlight my time form elements along with error message
>
> --
> 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@googlegroups.com.
> For more options, visit this group
athttp://groups.google.com/group/rubyonrails-talk?hl=en.
--
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@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.