cfif in a cfselect
I am new at Flash forms and I am running into a problem when a user is editing their data. When the user goes to their form to edit their data I want the select box to select the correct year.
If I hard code it like below then it works.
<cfselect name="dob_year" width="60">
<option value = "#the_dob_year#" <cfif #dateformat(DOB, "yyyy")# eq '1992'>selected="selected"</cfif>>1992</option>
<option value = "#the_dob_year#" <cfif #dateformat(DOB, "yyyy")# eq '1991'>selected="selected"</cfif>>1991</option>
<option value = "#the_dob_year#" <cfif #dateformat(DOB, "yyyy")# eq '1990'>selected="selected"</cfif>>1990</option>
</cfloop>
</cfselect>
But I don't want to hard code it, I want to query this data. When I use the below select box, it makes my from disappear.
<cfselect name="dob_year" width="60">
<cfloop from = "1" to = "100" index = "i">
<option value = "#the_dob_year#" <cfif #dateformat(DOB, "yyyy")# eq '#the_dob_year#'>selected="selected"</cfif>>#the_dob_year#
<cfset the_dob_year = '#the_dob_year - 1#'>
</option>
</cfloop>
</cfselect>
Any suggestions?
