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

nesting cfform behavior....

Community Beginner ,
Jan 23, 2013 Jan 23, 2013

Copy link to clipboard

Copied

I have the following code and I have tested it in chrome and IE:

<cfform name="form1" action="http://www.yahoo.com" method="post" >

     <cfloop index="X" from="1" to="9">

        <cfform name="form2" action="http://www.google.com" method="post">

            <cfinput type="submit" name="GOOGLE" value="GOOGLE#X#">

        </cfform>

    </cfloop>

   

<cfinput type="submit" name="YAHOO" value="YAHOO">

</cfform>

All the google buttons should submit and go to google.com....The yahoo button should go to yahoo.com.  I have code similar to this working elsewhere in my application, but this one has me stumped.  The first buton in the loop(when x is 1), is surrounded by the form1 tags and goest to yahoo.com, and the remaining buttons are surrounded by form2 tags and go to google.com like they are supposed to.  The final yahoo button is not surounded by a form tag at all and does nothing.  I know there is something I am missing....I thought you couldnt nest from tags, but I do it elsewhere and it works fine.  I feel like it is something easy I am missing.  HELP!

Views

949

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 ,
Jan 23, 2013 Jan 23, 2013

Copy link to clipboard

Copied

Even if it works, you cannot nest form tags.

^_^

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 Beginner ,
Jan 23, 2013 Jan 23, 2013

Copy link to clipboard

Copied

If it works, I guess I CAN nest forms.

I have code in production for years with nested forms much more complicated than this.  I am not worried about this project, but now I have to go back and fix the code that shouldnt work.

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 ,
Jan 23, 2013 Jan 23, 2013

Copy link to clipboard

Copied

It's hard to tell with the code you posted, especially when you use the term "surrounded by".  The code you posted should show 10 buttons labeled google 1-9, then yahoo. 

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 Beginner ,
Jan 23, 2013 Jan 23, 2013

Copy link to clipboard

Copied

LATEST

It does show 10 buttons in total.  The first and 10th buttons do not function like I would expect them to.  The first button, google 1, goest to yahoo.com rather than to google.com.  The last button, does nothing because it is never within the html form tags after coldfusion generates the html.  It is within the cfform tags, but not the html form tags.  I use the inspect feature in chrome and can see the html that is being generated contradicts the cfml.  Throw it in a cfm file and run it.  Then, inspect each button.  I am really curious why this happens.

I can make my page do something else, and I probably will rather than nesting the form tags.  I am glad I stumbled upon this because maybe I can save myself some headache later on.  However, there are conflicting reports online whether you can nest the cfform tags.  I hear it wont work in html, and other I hear do it regularly.

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