PDA

View Full Version : Capturing and Passing Jason's Calendar Date



Sgt.Bilko
01-13-2007, 12:10 AM
1) Script Title: Jason's Date Input Calendar

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex7/jasoncalendar.htm

3) Describe problem: Can't capture date

Hello,

First, there is no problem with the calendar code, it is because I am a twit and new to forms, HTML, js ... the list goes on. The problem is that I simply don't have the foggiest how to pass the date, entered using Jason's Calendar, from my form and (eventually) into an email. The DD example given (below) illustrates the date being shown when a button is clicked.

<form>

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

<input type="button" onClick="alert(this.form.orderdate.value)" value="Show date value passed">

</form>

However, I wish the date to be one of many variables taken and sent to an email on clicking a "submit" button. I *think* the answer must be easy, but I have tried in vain to get it to work. I assume the lines of code I need are something like:

<script>DateInput('orderDate', true, 'DD-MON-YYYY')</script> <input name="Date" type="hidden" onChange="alert(this.form.orderDate.value)" />

Although this does fails to send the date.

Any help appreciated. Forgive me if this is ridiculously easy :o

jscheuer1
01-13-2007, 03:35 AM
First off, this:


<input type="button" onClick="alert(this.form.orderdate.value)" value="Show date value passed">

Is just for testing/diagnostic purposes. The script itself creates a hidden input field with the date data. The name of that field is configurable and shown in red in the below call:


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

So, if the script is placed within your form and your form grabs the value of all of its fields, you are in business. Otherwise, you need to add something to your form processing routine so that it will grab the value contained in the orderdate field and do with it whatever it is that you want done with it.

Sgt.Bilko
01-13-2007, 10:31 AM
Clunk!

Many thanks indeed John. On reading through the details on the example page it becomes immediately obvious what to do... only now that you have explained it to me!

Thanks again :)