473,230 Members | 1,464 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,230 software developers and data experts.

How can I pass trough all objects of a form, if some of them are contained in divs?


I'm trying to pass trough all the objects of a form but I have some text
inputs in a DIV and I have many DIVs like this on my form.

I'm doing something like:

for (i = 0; i < document.forms(0).item.length; i++) {

but document.forms(0).item.length are the objects that are outside the

How can I pass trough all the objects of a form if some of them are
contained in divs?

Thanks a Lot!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #1
1 4134
Andrés Giraldo <an************@yahoo.com> writes:
I'm trying to pass trough all the objects of a form but I have some text
inputs in a DIV and I have many DIVs like this on my form.
What, exactly, do you mean by "all the objects of a form"?

If you only want to access the actual form controls (input, select,
textarea elements), then what you do is close to correct:

for (var i=0;i<document.forms[0].elements.length; i++) {

Use square brackets! Both forms and elements are collections, not
for (i = 0; i < document.forms(0).item.length; i++) {
This makes a lot of assumptions.

document.forms is a collection. It has a method called "item" that you can use to access the parts of the collection, or you can use square bracket notation.
document.forms.item(0) or document.forms[0]

However, IE shares the same object for both the forms collection and the
item function ("document.forms == document.forms.item" is true), so you
can get away with writing "document.forms(0)". Most other browsers wouldn't
accept that.

Likewise, in IE, for a form,
form == form.elements and form == form.elements.item

but document.forms(0).item.length are the objects that are outside the
The above code iterates through all form controls, and nothing else.
The div's have no influence on this at all.
How can I pass trough all the objects of a form if some of them are
contained in divs?

Div's make no difference (unless you are using Netscape 4 and
positioned divs, which it interprets as layers and therefore separate

Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2

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

Similar topics

by: Gerhard Pretorius | last post by:
ON Win 2003 IIS6, Since yesterday, (12 Aug 2003) for some strange reason, (after installing WindowsServer2003-KB823980-x86-ENU.exe) I cannot pass the Request object to to VB COM DLL. I have...
by: Dan R Brown | last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to break up this form into several "tabbed" sections, I break up the form using <div> tags. Each <div...
by: Seeker | last post by:
Newbie question here... I have a form with some radio buttons. To verify that at least one of the buttons was chosen I use the following code ("f" is my form object) : var btnChosen; for...
by: bebelino | last post by:
Hello, this should be an easy one, but I've had always troubles with it. How to pass trough a querydef-variable, form-variable and so on from a function to the caller-routine? Is there a simply...
by: Mountain Bikn' Guy | last post by:
It is known that one cannot pass arguments as ref or out in a marshal-by-reference class. My problem is that I have a C DLL (and C# wrapper) that I need to isolate in an AppDomain and then I need...
by: equip200 | last post by:
i would like some assistance on how to pass data or string from one vb program to another c# program. can this be done with vbscript code to send data to the c# program? Thanks
by: Radi Radichev | last post by:
Hi! I'm making a database application and i heard from a friend that it is more proffecional and easy to do this with bussines objects. Can anyone tell me where i can find more info on bussines...
by: Rob | last post by:
I have a control (Button) on a Parent form which opens a Windows form... all I want to do is pass a value from the child form back to the parent... it should be so simple... i.e....
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.