I have a form with two checkboxes. When a checkbox is selected I would like to
do a cfinclude with the proper form. I want to keep the checkbox slections on
top of the page for further entries. This is what I have so far with no luck...
<cfinput type="checkbox" name="checkbox_me" value="yes"><cfif
IsDefined("form.checkbox_me") and #form.checkbox_me# NEQ "">
<cfinclude template="Meal-Ent_Options.cfm">
Meal/Entertainment
</th>
<th class="form_text12b_caps" scope="col"><cfinput type="checkbox"
name="checkbox_m" value="mileage" id="checkbox"><cfelse
IsDefined("form.checkbox_m") and #form.checkbox_m# NEQ ""><cfinclude
template="Mileage_Options.cfm"></cfif>
<label for="checkbox">Mileage</label></th>
Thanks for any help.
Wally Kolcz - 28 Sep 2006 19:40 GMT
Do you have a trigger on the check box itself or a submit? What triggers the
<cfif IsDefined..>?
Dan Bracuk - 28 Sep 2006 20:22 GMT
I had a similar requirement once. The way I handled it was to write 2 forms on
the same page. Then I wrote some javascript so that the one that the user saw
depended on whether or not the check box was checked.
I used the cfsavecontent variable to code the elements common to both forms.
On the action page, I used isDefined("form.something") to determine what form
had been submitted.
Sabaidee - 29 Sep 2006 19:41 GMT
remember that CF code is processed on CF server. thus, if you want to use
<cfinclude> to show your sub-forms, you will have to re-submit the page to the
server to be processed (=submit your form).
in your case i would suggest using javascript to show/hide a subform instead.