-
Jason's Date Input Calendar
1) Script Title: Jason's Date Input Calendar
2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...oncalendar.htm
3) Describe problem: I've been using this script for a long time and it is brilliant. There is just one refinement I would like to include, but I'm getting nowhere trying to work it out for myself.
I use the script on a hotel booking form so there are two inputs on the same same form: Arrival Date and Departure Date. It is currently set up with the default which shows the current date, until the user changes it. Unfortunately, a significant number of users fill in the departure date incorrectly because they don't change the month.
For instance, if today is 1 Jan 2009, that is what shows in both fields when the page first comes up. The user then changes the arrival date to 3 Feb 2009 and wants to stay at the hotel for a week. They then go to the departure date and change the day to "10", which then gives the departure date as 10 Jan 2009. Wrong!
I would like to make the script operate so that once the arrival date is filled in, the departure date changes from current date to arrival date. I've tried various ideas but being a javascript numpty, I haven't yet made it work. Any ideas, anyone?
-
-
Could you post the code you have now, or a link to the site?
-
-
I should have thought of that!
The script is bog standard Jason's calendar. It's at http://www.littlehotels.co.uk/js/arDateInput.js. An example of the form is http://www.littlehotels.co.uk/enquiryform.php.
The crucial bit of the enquiry form page (starting at line 301) is:
<tr class="formleft">
<td>Arrival Date</td>
<td>
<script>DateInput('ArrDate', true, 'YYYY-MM-DD')</script>
</td>
</tr>
<tr class="formleft">
<td valign="top">Departure Date</td>
<td>
<script>DateInput('DepDate', true, 'YYYY-MM-DD')</script>
<span class="formnote"> (The morning you will check out) </span></td>
</tr>
I don't use the fourth argument in DateInput at the moment so it defaults to current date. I assume that I probably need to make the fourth argument of DepDate show a string version of ArrDate, and then use something like onBlur or onMouseUp to make the script re-run after ArrDate has been filled in. I've tried all sorts of things, but I just haven't been able to make it work.
Thanks for your assistance.
-
-
-
-
Yes, that's the one. I didn't spot the typo in my last post.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks