View Full Version : Simple change to output of Jason's calendar

06-01-2006, 09:42 PM
Hi - Jason's script looks great. Can someone please help me to convert the output to have values of "day", "month" and "year" in a select form (example below) I'm modifying a CMS I found and I know a little php but ZERO Javascript so if you do help please don't use too much JS jargon :)

thanks in advance

-------------------Example output below---------------------------------

<script>DateInput('orderdate', true, 'DD-MON-YYYY')</script>

convert to following format;

<select name="day"><option selected value="13">Day</option></select>
<select name="month"><option selected value="2">Month</option</select>
<select name="year"><option selected value="1975">Year</option></select>

06-02-2006, 04:37 AM
Warning: Please include a link to the DD script in question in your post. See this thread (http://www.dynamicdrive.com/forums/showthread.php?t=6) for the proper posting format when asking a question.

Please post a link to the page on your site that contains the problematic script so we can check it out.

I think this was already answered, try searching the archives. Yes, look here:


06-02-2006, 07:25 AM
Ok - thanks for that. Here's the link to the script - I don't believe a link to my site will help in this case;

Jason's Date Input Calendar


I read that post before actually. To be honest, I can't understand it or Jason's script - I'm slowly learning PHP and I can generally understand even some complex PHP scripts, but I'm struggling with JS even after I spent a couple of hours going through this script.

Can you point me to the specific portion in the JS which specifies the "writeln" output for;

<select name="dateinput">'DD-MON-YYYY'</select>

and possibly a clue as to how I can change it to have the following output;

<select name="day">DD</select>
<select name="month">MON</select>
<select name="year">YYYY</select>

Apologies for my lack of knowledge - and many thanks for any help.


06-02-2006, 08:25 AM
It isn't one specific spot. The writeln code actually writes other code that accomplishes these things when the user interacts with it. If you follow the instructions from that post, a simple 'replace from here to the end of the script with this' - it will work just like the original except in the format DD-MM-YYYY, which is what you want, right?

06-02-2006, 08:46 AM
Ok - I think see where I've gone wrong in my earlier question.

Actually - I'm struggling with how the Javascript interacts during the POST function. NOT the day/month ordering for presentation (incidently I did want DD/MM/YYYY in the final rendering but I managed to get that relatively easily.

My problem is that I am quite new to programing and I don't have a complete grasp of how the POST works and so I'm stuggling with finding the critical parts in Jason's script to change the POST sent from the JS script that will be received by the next CMS page.

If I'm understanding it correctly- I believe the javascript creates the presentation of the calendar and then, on the submit action, it posts the date selected to the page that recieves the post(?) .

All I know is that the original CALENDAR FORM in the CMS formats its date in 3 separate <select> statements. One each for the Day, Month and Year (I don't believe presentation ordering is relavant here). I'm not completely sure what the post data from Jasons script looks like or how to change it to get it to interact with the CMS scripts correctly. Essentially I want to know how to check the POST format from the script and to then change it if needed.

I've written a lot and if you made it this far then well done!!!!

06-02-2006, 09:00 AM
The way it posts is controlled here in the script call on your presentational page (from the demo page's step2, highlight red):

<script>DateInput('orderdate', true, 'DD-MON-YYYY')</script>

You can configure to post in many ways (also from the demo page, under additional information):

* 2-digit year can be used instead of 4-digit year
** 3-character month name abbreviation can also be specified as MMM.

06-03-2006, 12:06 AM
Thanks John - I spent this morning learning about datestamps and it seems that the way the CMS required it to be broken down into the 3 separate selects was circumventable and the date stamp could be used straight out of Jason's script without modification.

thanks for your patience,

Duncan :)