• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

checkbox and cfinclude

New Here ,
Sep 28, 2006 Sep 28, 2006

Copy link to clipboard

Copied

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.
TOPICS
Advanced techniques

Views

302

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 28, 2006 Sep 28, 2006

Copy link to clipboard

Copied

Do you have a trigger on the check box itself or a submit? What triggers the
<cfif IsDefined..>?


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 28, 2006 Sep 28, 2006

Copy link to clipboard

Copied

I would like to have it triggered when the box is checked. Any suggestions?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 28, 2006 Sep 28, 2006

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 29, 2006 Sep 29, 2006

Copy link to clipboard

Copied

LATEST
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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation