MS SQL Server 2005
I have a long form with data input fields of all kinds: text, checkbox, textarea, radio. I would like to get onSubmit validation to work for all input fields.
Currently, onSubmit validation works for all of the text
fields in the form. However, I also have eleven different CFSELECT input fields. When I set an attribute required="yes" for any CFSELECT input field, then onSubmit validation does not work; instead, form validation defaults to onServer validation, and displays the less-than-user-friendly onServer validation error page.
I've been looking around the web for answers to this problem. One solution wanted me to edit CFIDE/scripts/cfform.js:
... which I did; however, onSubmit validation still did not work, so I reverted to the original cfform.js file.
Does anyone have a solution to get onSubmit validation to work for these CFSELECT input fields? As an example, I post below the code for the "State" CFSELECT menu. Thanks as always.
<!--- default value for form.state --->
<cfparam name="form.State" default="">
<!--- path to cfform.js is confirmed valid --->
<cfform method="post" enctype="multipart/form-data" scriptsrc="#Request.CFFORM_JS_LIB#" name="NBPTSForm" id="NBPTSForm">
<!--- other required text fields here .... --->
<!--- this query selects State Titles from tbl_NBPTS_Lookup_State --->
<cfquery datasource="#APPLICATION.dataSource#" name="GetStates">
State: <cfselect size="5" name="State" value="State_Post_Abbr" display="State_Post_Abbr" multiple="no" query="GetStates" queryPosition="below" selected="#getuserDetails.State#" id="State" required="yes" message="Please enter your state of residence." validateAt="onSubmit,onServer">
<option value=""> Select State: </option>
<!--- submit form .... --->