2 Replies Latest reply: Apr 3, 2012 1:45 AM by djeter3 RSS

    CFLAYOUT and Form's target

    fabio.bozzo Community Member

      I just setup a border layout for my page, here's some code:

       

      <cflayout type="border">
               <cflayoutarea position="top" size="80" align="right">
                   <p>
                       <cfform name="logMeout" action="#CGI.script_name#" method="post" target="_top"> 
                             <cfinput type="submit" name="logout" value="Logout" />
                         </cfform>
                     </p>
              </cflayoutarea>

      ...

      ...

       

      When I click that button, the logout page displays in the top bar.

       

      What I want is to display the page in the window, I mean, reload the entire http page.

       

      I tried target _top but it does not work. So what?

        • 1. Re: CFLAYOUT and Form's target
          Sam Farmer Community Member

          Try this:

           

          <cfform name="logMeout" id="logMeout" action="#CGI.script_name#" method="post" target="_top">  

          <input type="button" 
                    onclick="if (_CF_checklogMeoutForm(this.form)) {document.logMeout.submit();}" 
                    value="Submit">
          </cfform>

           

           

          More information here:

          http://samfarmer.instantspot.com/blog/2009/06/14/Submitting-a-cfform-inside-a-cfdiv-to-a-n ew-page

          • 2. Re: CFLAYOUT and Form's target
            djeter3 Community Member

            This worked for me...

             

            CFForm does something strange to the form code on submit.  Make the type of the submit to 'button' and add javascript to submit the form.  I have included the fix below.

             

            <cflayout type="border">

                     <cflayoutarea position="top" size="80" align="right">

                         <p>

                             <cfform name="logMeout" action="#CGI.script_name#" method="post" target="_top"> 

                                   <cfinput type="button" name="logout" value="Logout" onClick="javascript:document.logMeout.submit()"/>

                               </cfform>

                           </p>

                    </cflayoutarea>

             

            Dennis