473,387 Members | 1,650 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

nested forms

Sometimes I may have one form nested inside the other (this is an editable
page).

<form name="form1">

<form name="form2">
</form>

<input type="text" name="form_element_for_form1">
</form>

What I'd like to do is read: form_element_for_form1, but the closing tag for
form2 kills form1.

How do I remove form2? It seems to be resistant!

Jeff
Jul 20 '05 #1
3 2601
In article <OT******************@newsread3.news.atl.earthlink .net>,
no****@nospam.net says...
Sometimes I may have one form nested inside the other (this is an editable
page).


You *cannot* nest forms.

--
Hywel I do not eat quiche
http://hyweljenkins.co.uk/
http://hyweljenkins.co.uk/mfaq.php
Jul 20 '05 #2

"Hywel Jenkins" <hy**********@hotmail.com> wrote in message
news:MP************************@news.individual.ne t...
In article <OT******************@newsread3.news.atl.earthlink .net>,
no****@nospam.net says...
Sometimes I may have one form nested inside the other (this is an editable page).
You *cannot* nest forms.


Yes, but can I remove the nested form with javascript?

Jeff
--
Hywel I do not eat quiche
http://hyweljenkins.co.uk/
http://hyweljenkins.co.uk/mfaq.php

Jul 20 '05 #3


Jeff Thies wrote:
Sometimes I may have one form nested inside the other (this is an editable
page).

<form name="form1">

<form name="form2">
</form>

<input type="text" name="form_element_for_form1">
</form>

What I'd like to do is read: form_element_for_form1, but the closing tag for
form2 kills form1.

How do I remove form2? It seems to be resistant!


Look into the Mozilla DOM inspector on how that HTML is parsed, there
will be only one <form> element in the DOM tree which has no element
children and the <input> element doesn't have a form container:

<html>
<head>
<title>nested forms?</title>
<script type="text/javascript">
function inspectForms () {
var text = '';
for (var i = 0; i < document.forms.length; i++) {
var form = document.forms[i];
text += 'form with index ' + i + ' has name ' + form.name +
' and parentNode ' + form.parentNode + ' with tagName ' +
form.parentNode.tagName + '\n';
}
if (document.getElementsByName) {
var input = document.getElementsByName('form_element_for_form1 ')[0];
if (input) {
text += 'input.form is ' + input.form + '\n';
}
}
alert(text);
}

window.onload = function (evt) {
inspectForms();
};
</script>
</head>
<body>
<form name="form1">

<form name="form2">
</form>

<input type="text" name="form_element_for_form1">
</form>
</body>
</html>

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jamie | last post by:
Just thought i'd post this tip for developers who are having problems submitting HTML forms which reside inside a parent ASPX web form. basically, HTML forms wont submit correctly if they're...
2
by: pk | last post by:
Let me start off by mentioning that I'm not a web developer by any means. I welcome any and all tips regarding code cleanliness and would love to hear about any conventions that I'm breaking. I...
1
by: oncewaswillow | last post by:
Hi, I have 3 nested forms and want to calculate a total on the first subform (as the form loads)by adding 2 fields from that form + to a field on the second subform. Second subform is and...
10
by: nimmi_srivastav | last post by:
Below you will see an example of a nested conditional expression that this colleague of mine loves. He claims that it is more efficient that a multi-level if-else-if structure. Moreover, our...
5
by: ~~~ .NET Ed ~~~ | last post by:
Hi, As you all know when an ASP.NET web form is created that will include web controls and such, it contains a FORM that that identifies the web form and its containing controls. Well, I have a...
12
by: upernikaw | last post by:
Hello, I am attempting to create a nested loop (in Access 2003/VB) that will print a report for a set of user defined months inputed on a form and that will print out for every Client. So the first...
8
by: Ragbrai | last post by:
Howdy All, I have a query that is used for filtering results to be used in a combo box. The query needs to test fields from both a table and then unbound text boxes on the form that also contains...
8
by: =?Utf-8?B?QW1yaXQgS29obGk=?= | last post by:
Okay, after much research, I have discovered a few interesting things in ASP.NET. I have a MasterPage that has a WebForm on it and it looks like this: <body> <form id="controls"...
4
by: Patrick A | last post by:
All, I rely on nested IF statements with multiple conditions heavily, and someone suggested recently writing the statements (and especially reading them months later) would be much easier if I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.