creating custom form error handling

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'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.