Question About Date Fields

terp

Beta Tester Extraordinaire
...been awhile since I posted a question and not a problem. :)

I have a form with a 'check-in' date and a 'check-out' date; though I am still struggling to get the validations down, I am trying to avoid someone entering a check-out date that is earlier than the check-in date. :)

So, for example, if your check-in date is July 28, 2008, the check-out date should be > check-in date.

Given that date fields are greek to me and sometimes tricky little buggers, I thought I would ask: is there an easy way to handle this?

I am more than willing (and working on it now, and think perhaps a better solution) to change the whole form around to accommodate my shortcoming and remove the check-out date altogether and add a drop-down for 'number of nights.' :) I think this will work better anyway, so this is just a 'I wonder how one could do that' kind of question to build my knowledge base. ;)
 
The only way I can think of is to have an onChange JS event on the checkout date, and validate it there. You'd also need to add an onSubmit to the form, which I think you can do in the backend in 2.0, but in 1.0 is custom JS. You have to do the same validation onSubmit, in case they never 'blur' from the date picker before submitting the form.

Actually, it's possible that 2.0 new Ajax validation might make this easier, but I'd have to check with Rob.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top