-
1
- #1
How do i validate date and time which is a drop down menu?
The date has day(1 to 31), the month (January to December)which is a drop down menu and the year field which takes the system year(it is not a drop down menu)
The time consists of hour, minute and am, pm which all of them is a drop down menu.
I have tried using coldfusion validation but it doesn't work for the date. This is the code which i used to display the date and the validation. May i know how does coldfusion does validation for drop down menus like date and time.
<tr>
<td nowrap>
<div align="right"><font face="Arial, Helvetica, sans-serif" size="2">
<b>Date : </b></font></div>
</td>
<td> <font size="2">
<Select name="b_date_day" size=1>
<option value="1"<cfif b_date_day IS "1">selected</cfif>>01
<option value="2"<cfif b_date_day IS "2">selected</cfif>>02
<option value="3"<cfif b_date_day IS "3">selected</cfif>>03
<option value="4"<cfif b_date_day IS "4">selected</cfif>>04
<option value="5"<cfif b_date_day IS "5">selected</cfif>>05
<option value="6"<cfif b_date_day IS "6">selected</cfif>>06
<option value="7"<cfif b_date_day IS "7">selected</cfif>>07
<option value="8"<cfif b_date_day IS "8">selected</cfif>>08
<option value="9"<cfif b_date_day IS "9">selected</cfif>>09
<option value="10"<cfif b_date_day IS "10">selected</cfif>>10
<option value="11"<cfif b_date_day IS "11">selected</cfif>>11
<option value="12"<cfif b_date_day IS "12">selected</cfif>>12
<option value="13"<cfif b_date_day IS "13">selected</cfif>>13
<option value="14"<cfif b_date_day IS "14">selected</cfif>>14
<option value="15"<cfif b_date_day IS "15">selected</cfif>>15
<option value="16"<cfif b_date_day IS "16">selected</cfif>>16
<option value="17"<cfif b_date_day IS "17">selected</cfif>>17
<option value="18"<cfif b_date_day IS "18">selected</cfif>>18
<option value="19"<cfif b_date_day IS "19">selected</cfif>>19
<option value="20"<cfif b_date_day IS "20">selected</cfif>>20
<option value="21"<cfif b_date_day IS "21">selected</cfif>>21
<option value="22"<cfif b_date_day IS "22">selected</cfif>>22
<option value="23"<cfif b_date_day IS "23">selected</cfif>>23
<option value="24"<cfif b_date_day IS "24">selected</cfif>>24
<option value="25"<cfif b_date_day IS "25">selected</cfif>>25
<option value="26"<cfif b_date_day IS "26">selected</cfif>>26
<option value="27"<cfif b_date_day IS "27">selected</cfif>>27
<option value="28"<cfif b_date_day IS "28">selected</cfif>>28
<option value="29"<cfif b_date_day IS "29">selected</cfif>>29
<option value="30"<cfif b_date_day IS "30">selected</cfif>>30
<option value="31"<cfif b_date_day IS "31">selected</cfif>>31
</select>
<Select name="b_date_month" size=1>
<option value="1"<cfif b_date_month IS "1">selected</cfif>>January
<option value="2"<cfif b_date_month IS "2">selected</cfif>>February
<option value="3"<cfif b_date_month IS "3">selected</cfif>>March
<option value="4"<cfif b_date_month IS "4">selected</cfif>>April
<option value="5"<cfif b_date_month IS "5">selected</cfif>>May
<option value="6"<cfif b_date_month IS "6">selected</cfif>>June
<option value="7"<cfif b_date_month IS "7">selected</cfif>>July
<option value="8"<cfif b_date_month IS "8">selected</cfif>>August
<option value="9"<cfif b_date_month IS "9">selected</cfif>>September
<option value="10"<cfif b_date_month IS "10">selected</cfif>>October
<option value="11"<cfif b_date_month IS "11">selected</cfif>>November
<option value="12"<cfif b_date_month IS "12">selected</cfif>>December
</select>
<cfoutput>
<cfinput type="Text" Name="b_date_year" size="4" Maxlength="4" value="#b_date_year#" required="Yes"
message="Date field should not be left blank!"></cfoutput>
</font></td>
</tr>
The date has day(1 to 31), the month (January to December)which is a drop down menu and the year field which takes the system year(it is not a drop down menu)
The time consists of hour, minute and am, pm which all of them is a drop down menu.
I have tried using coldfusion validation but it doesn't work for the date. This is the code which i used to display the date and the validation. May i know how does coldfusion does validation for drop down menus like date and time.
<tr>
<td nowrap>
<div align="right"><font face="Arial, Helvetica, sans-serif" size="2">
<b>Date : </b></font></div>
</td>
<td> <font size="2">
<Select name="b_date_day" size=1>
<option value="1"<cfif b_date_day IS "1">selected</cfif>>01
<option value="2"<cfif b_date_day IS "2">selected</cfif>>02
<option value="3"<cfif b_date_day IS "3">selected</cfif>>03
<option value="4"<cfif b_date_day IS "4">selected</cfif>>04
<option value="5"<cfif b_date_day IS "5">selected</cfif>>05
<option value="6"<cfif b_date_day IS "6">selected</cfif>>06
<option value="7"<cfif b_date_day IS "7">selected</cfif>>07
<option value="8"<cfif b_date_day IS "8">selected</cfif>>08
<option value="9"<cfif b_date_day IS "9">selected</cfif>>09
<option value="10"<cfif b_date_day IS "10">selected</cfif>>10
<option value="11"<cfif b_date_day IS "11">selected</cfif>>11
<option value="12"<cfif b_date_day IS "12">selected</cfif>>12
<option value="13"<cfif b_date_day IS "13">selected</cfif>>13
<option value="14"<cfif b_date_day IS "14">selected</cfif>>14
<option value="15"<cfif b_date_day IS "15">selected</cfif>>15
<option value="16"<cfif b_date_day IS "16">selected</cfif>>16
<option value="17"<cfif b_date_day IS "17">selected</cfif>>17
<option value="18"<cfif b_date_day IS "18">selected</cfif>>18
<option value="19"<cfif b_date_day IS "19">selected</cfif>>19
<option value="20"<cfif b_date_day IS "20">selected</cfif>>20
<option value="21"<cfif b_date_day IS "21">selected</cfif>>21
<option value="22"<cfif b_date_day IS "22">selected</cfif>>22
<option value="23"<cfif b_date_day IS "23">selected</cfif>>23
<option value="24"<cfif b_date_day IS "24">selected</cfif>>24
<option value="25"<cfif b_date_day IS "25">selected</cfif>>25
<option value="26"<cfif b_date_day IS "26">selected</cfif>>26
<option value="27"<cfif b_date_day IS "27">selected</cfif>>27
<option value="28"<cfif b_date_day IS "28">selected</cfif>>28
<option value="29"<cfif b_date_day IS "29">selected</cfif>>29
<option value="30"<cfif b_date_day IS "30">selected</cfif>>30
<option value="31"<cfif b_date_day IS "31">selected</cfif>>31
</select>
<Select name="b_date_month" size=1>
<option value="1"<cfif b_date_month IS "1">selected</cfif>>January
<option value="2"<cfif b_date_month IS "2">selected</cfif>>February
<option value="3"<cfif b_date_month IS "3">selected</cfif>>March
<option value="4"<cfif b_date_month IS "4">selected</cfif>>April
<option value="5"<cfif b_date_month IS "5">selected</cfif>>May
<option value="6"<cfif b_date_month IS "6">selected</cfif>>June
<option value="7"<cfif b_date_month IS "7">selected</cfif>>July
<option value="8"<cfif b_date_month IS "8">selected</cfif>>August
<option value="9"<cfif b_date_month IS "9">selected</cfif>>September
<option value="10"<cfif b_date_month IS "10">selected</cfif>>October
<option value="11"<cfif b_date_month IS "11">selected</cfif>>November
<option value="12"<cfif b_date_month IS "12">selected</cfif>>December
</select>
<cfoutput>
<cfinput type="Text" Name="b_date_year" size="4" Maxlength="4" value="#b_date_year#" required="Yes"
message="Date field should not be left blank!"></cfoutput>
</font></td>
</tr>