Form variables

Raj_IN
Raj_IN used Ask the Experts™
on
Hi experts,

I am not sure whether this is a ColdFusion or HTML issue, but I have following problem to address in my web application.

I have a form structure like this:

<form name=one method=post action="my.cfm">
   <input type=text name=a>
   <input type=text name=b>

           <form name=two>
                   <input type=text name=c>
                   <input type=text name=d>
                    <input type=submit onClick="open.window()">
            </form>
     <input type=submit name=click value=click>        
</form>

One form is embedded into the other. When I click the last "click" button, I expect to "post" the values of "a" and "b" to "my.cfm", but much to my discomfort, it does nothing. I can't change the structure of the above forms. Please let me know if there is a way to solve the above

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
you cannot nest forms.  why are you needing to do that?  you can have more than one submit button in the same form, and process based on which button was pushed...

Author

Commented:
I have more than one than submit button, but I can't move my last sumit button above the embedded form.  The cfm structure I am using gives me no room to alter this structure. The embedded form appears only under one condition, and it doesn't appear during the other conditions. Is there a way out using JavaScript?

Commented:
you can't do it that way.  what are you trying to accomplish?  if you let me know, i can tell you another way to accomplish it.  but there is absolutely no way to nest forms in html- it just won't work.
CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

Commented:
yes substand is correct

NESTING of FORMS is NOT ALLOWED !

use LAYERS if u wanna display things one inside other

but logically they wld be outside & no nesting of forms wld be there

but to the end user it wld appear as if the forms are nested

hope that helps

K'Rgds
Anand

Author

Commented:
Thanks everyone for your suggestions. I agree that CSS Layers is one possible solution for the above, but I found a better solution with JavaScript using an event handler - onChange. I kept the last submit button in a separate form tag, and included hidden fields for "a" and "b". Whenever the fields in "a" and "b" are entered, the event handler writes the same value in the hidden fields below. Its a round about way, but serves the purpose.

Thanks again
PAQed, with points refunded (50)

Computer101
E-E Admin

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial