Hi...
I have an "appointments" page where the user should (or not
necessarily) choose a date and time for his appointment, from 6 combo
boxes:year, month, day, hour, minute and AM or PM, without seconds
'cause I set them to 0.
I need to be able to save them in the database (Access) where the
format of the field is for example:
12/22/2004 14:08:00
Now, I do have already code that does that but my supervisor doesn't
like it because it's based on string concatenation of the values found
in combos.
He told me to use date/time validate functions...@#$!@#%@#$
Also a problem is that first, the user has an "Add" page where he
choses for the first time a date/time and then he has also an "Edit"
page where he should be able to modify (upadte) the already chosen
date/time. So, the validation solution should be in such a way that
after I save in the database, I should also be able to bring back from
the database the date/time back in the combos....
Now, the code looks like this (in ColdFusion) in the "form" page:
<td><font color="##124B0A">Start Time</font></td>
<td>
<select name="mySYear" onChange="return SDayFct(this.form);">
<option value="year">Year</option>
<cfloop index="z" from="2004" to="2025">
<option value="#z#">#z#</option>
</cfloop>
</select>
<select name="mySMonth" onChange="return SDayFct(this.form);">
<option value="month">Month</option>
<cfloop index="x" from="1" to="12">
<option value="#x#">#x#</option>
</cfloop>
</select>
<select name="mySDay">
<option value="day">Day</option>
</select>
<select name="mySHour">
<option value="hour">Hour</option>
<cfloop index="h" from="1" to="12">
<option value="#h#">#h#</option>
</cfloop>
</select>
<select name="mySMinute">
<option value="minute">Minute</option>
<cfloop index="m" from="0" to="59">
<option value="#m#">#m#</option>
</cfloop>
</select>
<input type="hidden" name="mySsecond" value="#00#">
<select name="Sampm">
<option value="AM">AM</option>
<option value="PM">PM</option>
</select>
</td>
....and like this (in the query)when I save:
['#(FORM.mySMonth & "/" & FORM.mySDay & "/" & FORM.mySYear & " " &
FORM.mySHour & ":" & FORM.mySMinute & ":" & FORM.mySSecond & " " &
FORM.Sampm)#',]
The SDayFct(this.form) function generates in JavaScript hte month and
day combos, depending on the leap year and the number of the days for
each month.
If it's not too complicated for you guys, I would really appreciate
any kind of help...otherwise, a murder is closing on me...#@$@#$##@!
it's about my supervisor.....
Thanks...