5 Replies Latest reply on Nov 26, 2012 8:08 AM by BKBK

    cfform inside a cfdiv submit?

    richardELeach Level 1

      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

        • 1. Re: cfform inside a cfdiv submit?
          BKBK Adobe Community Professional & MVP

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

          • 2. Re: cfform inside a cfdiv submit?
            richardELeach Level 1

            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

            • 3. Re: cfform inside a cfdiv submit?
              BKBK Adobe Community Professional & MVP

              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?

              • 4. Re: cfform inside a cfdiv submit?
                richardELeach Level 1

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

                • 5. Re: cfform inside a cfdiv submit?
                  BKBK Adobe Community Professional & MVP

                  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.