I had two fields in my form i.e start and end time fields, i am
validating times but i am not reflecting the error message at the
field, what should i have to do to diplay the error as “start time
should be before end time”.
please help me
validate :valid_times
def valid_times
if start_time >= end_time
self.errors.add :start_time, ‘has to be before end time’
end
end
Thanks for your reply, I dont want the error to dispaly at outline, i
want the error to display at near the date field i.e., inlne error
display is required for me. please help me how to get it.
Thanks in advance
Thanks for your reply, I dont want the error to dispaly at outline, i
want the error to display at near the date field i.e., inlne error
display is required for me. please help me how to get it.
Oh! Okay. That’s a bit more tedious code. What you can do then is
have the errors attach to the specific fields, and check for them when
displaying each field. I think there are some standard ways to do
this, but I don’t recall offhand where to find examples and
instructions. Google is your friend. IIRC, the default stuff will at
least put a red box around the specific fields, using CSS…