Guest_imported
New member
- Jan 1, 1970
- 0
Hi,
I have 3 fields for displaying date and time and am/pm in the form.
I need to validate these 3 fields in the form and in the action i need to concatenate them into one.
But I am having problem when concatenating "am/pm" field. It concatenates "am" irrespective of whatever i select in the form for that field. Please let me know how to do it.
Here is my code:
Form
-----
<cfinput type="Text" name="request_date" value="#DateFormat(url.r_date,'mm/dd/yy')#" message="Please enter date using mm/dd/yy format." validate="date" required="Yes" size="6">
<input type="hidden" name="r_Date_date" VALUE="Please enter date using mm/dd/yy format.">
<cfinput type="Text" name="r_time1" value="#TimeFormat(url.request_date,'HH:mm:ss')#" size="6" message="Please enter time using hh:mm:ss format." validate="time" required="Yes" >
<select name="r_time2">
<option value="AM" <cfif #TimeFormat(url.request_date,'tt')# eq 'AM'>selected</cfif>>AM
<option value="PM" <cfif #TimeFormat(url.request_date,'tt')# eq 'PM'>selected</cfif>>PM
</select>
<input type="hidden" name="r_time1_time" VALUE="Please enter Request Time using 'hh:mm:ss' format.">
<input type="submit" name="save" value="Save">
action:
------
<cfoutput>
<Cfset r_date=#dateformat(form.r_date,'mm/dd/yy')#>
<cfset r_time=#TimeFormat(form.r_time1,'hh:mm:ss')# & #form.r_time2#>
<cfset r_time=#timeformat(form.r_time1,'hh:mm:ss tt')#>
<cfset final_date='#r_date# #r_time#'>
#final_date#
#createodbcdatetime(r_date)#
</cfoutput>
Thanks in advance
I have 3 fields for displaying date and time and am/pm in the form.
I need to validate these 3 fields in the form and in the action i need to concatenate them into one.
But I am having problem when concatenating "am/pm" field. It concatenates "am" irrespective of whatever i select in the form for that field. Please let me know how to do it.
Here is my code:
Form
-----
<cfinput type="Text" name="request_date" value="#DateFormat(url.r_date,'mm/dd/yy')#" message="Please enter date using mm/dd/yy format." validate="date" required="Yes" size="6">
<input type="hidden" name="r_Date_date" VALUE="Please enter date using mm/dd/yy format.">
<cfinput type="Text" name="r_time1" value="#TimeFormat(url.request_date,'HH:mm:ss')#" size="6" message="Please enter time using hh:mm:ss format." validate="time" required="Yes" >
<select name="r_time2">
<option value="AM" <cfif #TimeFormat(url.request_date,'tt')# eq 'AM'>selected</cfif>>AM
<option value="PM" <cfif #TimeFormat(url.request_date,'tt')# eq 'PM'>selected</cfif>>PM
</select>
<input type="hidden" name="r_time1_time" VALUE="Please enter Request Time using 'hh:mm:ss' format.">
<input type="submit" name="save" value="Save">
action:
------
<cfoutput>
<Cfset r_date=#dateformat(form.r_date,'mm/dd/yy')#>
<cfset r_time=#TimeFormat(form.r_time1,'hh:mm:ss')# & #form.r_time2#>
<cfset r_time=#timeformat(form.r_time1,'hh:mm:ss tt')#>
<cfset final_date='#r_date# #r_time#'>
#final_date#
#createodbcdatetime(r_date)#
</cfoutput>
Thanks in advance