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

cfform inside a cfdiv submit?

Engaged ,
Nov 25, 2012 Nov 25, 2012

Copy link to clipboard

Copied

Hi All-

I currently have a .cfm file that has the following code:

<cfdiv bind="url:/homePageIncludes/homePageTabs.cfm?tab={tabtype}" bindonload="true" id="tabView"/>

... which seems to work fine, it calls homePageTabs.cfm which has a cfform on it. I want the cfform on this page to submit to itself without refreshing the page (which it appears to do).

My cfform code looks like this:

<cfform name="formTabs" method="post" action="/">

... and on my homePageTabs.cfm page I'm doing a cfdump to get the submitted form values but it keeps coming back empty. I need to be able to see the submit values as I have logic to build and display pages. I can see the form submitting without the entire page refreshing (exactly what I want) but can't seem to trap any values from the form submission.

When submitting a cfform to itself inside of a cfdiv, what exact values should I use for the action attribute? I'm assuming the method should be "post" and the docs said to give the form a unique name from the rest of the objects on the page. The various javascript functions (Coldfusion.ajax.submitform and coldfusion.navigate) did not work - the form simply did not submit at all, not even a flinch.  This code is on ColdFusion 8 and there are lots of posts about this but none seem to reveal those specifics about the cfform tag's attributes.

Anyone?

Thanks in advance,

Rich

Views

2.2K

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
Community Expert ,
Nov 26, 2012 Nov 26, 2012

Copy link to clipboard

Copied

What about <cfform name="formTabs" method="post">?

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 ,
Nov 26, 2012 Nov 26, 2012

Copy link to clipboard

Copied

Without the action="/" the entire page surrounding the cfdiv gets replaced with the action page; the entire page actually gets replaced which is what I don't want. Anyone know what that action= value should be?

Thanks for your input,

Rich

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
Community Expert ,
Nov 26, 2012 Nov 26, 2012

Copy link to clipboard

Copied

With or without the "/", the cfdiv is designed such that, when a form page within the cfdiv area is submitted, the action page is likewise displayed within the cfdiv area. Do you wish the action page would display in the usual way, as if there were no cfdiv?

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 ,
Nov 26, 2012 Nov 26, 2012

Copy link to clipboard

Copied

...no, that's the problem! The action page is not displaying inside the cfdiv area (unless I use that "/" in the action attribute) as the docs suggest, how do you make that happen? I want the action page results to be displayed inside the cfdiv container so that only the cfdiv section refreshes, not the entire page, but there seems to be a disconnect in there somewhere since I can't yield any form values when I do a cfdump var="#form#" (it comes back empty).

Thanks so much for you help,

Rich

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
Community Expert ,
Nov 26, 2012 Nov 26, 2012

Copy link to clipboard

Copied

LATEST

What happens when you place the following 2 CFM pages in the same directory, run testPage1.cfm, fill in some text and press the button?

testPage1.cfm

<cfajaximport tags="cfform">

<cfform>

          <cfinput type="text" name="testVar1" value="testVar1">

</cfform>

<cfdiv bind="url:testPage2.cfm?param={testVar1}"/>

testPage2.cfm

<cfif isdefined("form.testVar2")>

<cfdump var="#form#">

</cfif>

<cfform>

          <cfinput type="text" name="testVar2">

          <cfinput type="submit" name="sbmt" value="Test it!">

</cfform>

When I run it I get the expected result.

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