View Full Version : Modifying a Javascript Script

02 Dec 2008, 09:15 AM
I currently use Jason's Date Input Calendar for the arrival and departure dates on a hotel booking form. In every respect it's a brilliant script, but I do want to modify it slightly to make it even better (for my purpose).

An example of the form can be seen at www.littlehotels.co.uk/enquiryform.php and the script itself is at www.littlehotels.co.uk/js/calendarDateInput.js.

The DateInput function uses four arguments, tha last one being the date which is initally displayed. I leave that out so that it defaults to current date on both instances of the calendar (Arrival Date and Departure Date). What I would like to so now is make the Departure Date change to the Arrival Date as soon as the Arrival Date is filled in. This would reduce the number of user errors where visitors change the day of the departure date but not the month.

As far as I can see, I need to use the fourth argument on Departure Date to make it the same as Arrival Date. Then I need to make the appropriate part of the script re-run so that it detects the new Arrival Date. My problem is that the script is too complicated for my non-existent javascript skills, so I can't see how to do the changes.:wall:

Any help or advice would be greatly appreciated.