I have a form with multiple checkboxes for insurance types. If one or more are checked the insert works properly. However, if none are checked, I get an error that the field is "undefined in form". My action page insert query is written "<CFQUERYPARAM CFSQLType="CF_SQL_Varchar" Value="#Form.VCTM_REIMBRS_TYPE#" Null="#Len(Form.VCTM_REIMBRS_TYPE) EQ 0#">" and the SQL field is checked to allow NULLS. What am I missing?
For check boxes, if none are checked on the form, the form variable will not exist. There are several ways to deal with this. You must first, however, decide in plain english what you want to happen if nothing is checked. Translating that decision to code is usually simple.
Check the Form.VCTM_REIMBRS_TYPE isdefined
<cfif isdefined("Form.VCTM_REIMBRS_TYPE") AND len(trim(Form.VCTM_REIMBRS_TYPE))>