In reverse-order:
2. Number field (not a cfform just a plain form) - must validate that data
entered is a number
--> Use JavaScript to handle this on form submission. Or use CF: IsNumeric()
to handle it post-submission.
1. Date field (not a cfform just a plain form) - must validate that data
entered is a date
--> This comes up time and time again. I use this code for my clients;
you're welcome to use it. It's a simple form that uses drop-downs to force
proper formatting. Of course you may want to use IsDate() to make sure you
don't allow 2/30 for example.
Here's the code:
<FORM ACTION="{file.cfm}" METHOD="POST">
<CFOUTPUT>
<SELECT NAME="current_month">
<CFLOOP INDEX="month" FROM="1" TO="12">
<OPTION VALUE="#month#">#MonthAsString(month)#
</CFLOOP>
</SELECT>
<SELECT NAME="current_day">
<CFLOOP INDEX="day" FROM="1" TO="31">
<OPTION VALUE="#day#">#day#
</CFLOOP>
</SELECT>
<SELECT NAME="current_year">
<CFLOOP INDEX="year" FROM="2001" TO="2020">
<OPTION VALUE="#year#">#year#
</CFLOOP>
</SELECT>
<BR><BR>
<INPUT TYPE="SUBMIT" NAME="make_calendar" VALUE="Make Calendar">
</CFOUTPUT>
</FORM>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists