Solved

Nested Form Tags and Javascript

Posted on 2006-07-05
5
848 Views
Last Modified: 2008-02-01
Hi,

It appears nested forms do not work.. I have the following piece of code, which I had to simplify inorder to present my case.

<form name="aform" method="post" action="newfile.php">
      <input type="text" name="abc" value="somevalue">
      <input type="button" value="button" onclick="document.aform.submit();">

      <form name="bform" method="post" action="somefile.php">
      <input type="text" name="def" value="testvalue">
      <input type="button" value="button" onclick="document.bform.submit();">
      </form>
</form>


Can any body tell me why bform is not recognized by javascript and if there are any alterantives possible.. inorder to make this work..

Thanks
0
Comment
Question by:niftyhawk
  • 3
  • 2
5 Comments
 
LVL 36

Accepted Solution

by:
Zyloch earned 500 total points
ID: 17046768
You cannot put a form inside a form. Since your form fields do not really coincide, why don't you just have the forms separate? If you need two submits, then do one with Javascript, and the other one will be normal.

Ted
0
 
LVL 1

Author Comment

by:niftyhawk
ID: 17046807
well, the real use of having nested forms is... the outer form has a table with rows having checkboxes and text boxes.. the user can manage checked items options by checking the check boxes and deleting them or modifying them. the inner form has multiple checkboxes and textboxes for each row of the outer form.
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 17046818
So it's just a structure thing? I'm afraid the only way you can get any structure is to maybe surround your form elements with an IDed <div> or make your name your forms a certain way.

Ted
0
 
LVL 1

Author Comment

by:niftyhawk
ID: 17046846
hmm..all my inner forms have a differentname and action..however, they have to be surrounded by an outer form, otherwise how would I know what variables have been passed during the form post?
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 17046850
I'm not too sure what you mean... What are you trying to do exactly, and what do you expect the structure of your $_POST array to be?

Ted
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to format numbers and letters in nested lists 5 34
how can i turn the array into an object 4 49
javascript - insert into js doc help 2 25
send email part1 9 28
Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question