473,569 Members | 2,536 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Addressing form variables with the same form in separate forms (IE vs Firefox)

4 New Member
In IE it is simple to address form fields with the same name in multiple forms, such as:

Expand|Select|Wrap|Line Numbers
  1. document.firstform.mode.value='open';
  2. document.secondform.mode.value='new';
  3. etc
But in Firefox I am forced to use getElementById, as in:

Expand|Select|Wrap|Line Numbers
  1. document.getElementById['mode'].value='open';
But this doesn't include a form reference and so only changes the first use of mode.

Is there a FireFox friendly way to address similar named elements in different forms, without having to use mode1, mode2 etc.?
May 23 '07 #1
2 1312
Logician
210 New Member
In IE it is simple to address form fields with the same name in multiple forms, such as:

Expand|Select|Wrap|Line Numbers
  1. document.firstform.mode.value='open';
  2. document.secondform.mode.value='new';
  3. etc
That is not proper syntax, I.E. just accepts it.

There is no issue with different forms having elements of the same name.

If a form and its elements have name attributes, this syntax is universal:
Expand|Select|Wrap|Line Numbers
  1. document.forms.formName.elementName
If a form and its elements have id attributes, use
Expand|Select|Wrap|Line Numbers
  1. document.getElementById(elementId);
All id attributes within a document must be unique.

Do not pass a name attribute to document.getEle mentById - that's something else that shouldn't work in I.E.
May 23 '07 #2
pbmods
5,821 Recognized Expert Expert
You can also use getElementsByNa me.
May 24 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

13
74013
by: genetic.error | last post by:
I'm moving from Vb6 to VB.Net. I have a feeling this has come up before... The VS.Net MSDN file seems to state that the following should work: Form1.Show Form1.Visible = True Form1.Hide Form1.Visible = False Load (Form1)
0
1244
by: John Wood | last post by:
I have an ASP script in which I want to control the screen as two frames If I use a FRAMESET this works fine but the frame geometry is fixed the script uses POST and hidden fields to transfer the data from step to step, what I would like is to be able to change the sizes of the frames or even go from two frames to one and back to two as I go...
2
2249
by: news.microsoft.com | last post by:
I have a form that shows my name on the top half and my address on the bottom half. Is it possible to divide this form into two separate child forms (inside MDI form)? Thanks.
1
4512
by: iMedia User | last post by:
I have a site where I want to use the Web form validators in two separate forms on a single page. One form allows existing users to log in while the second one allows new users to register. The problem is that if I use the Web Form validation tags, it treats them all as one form (ie...if someone is trying to use the login form, they get an...
8
1725
by: Leszek | last post by:
Hi. I have two forms each in different file user need to fill both one after another. Is it possible to display variables from both forms at the end? does $_POST contains variables from both forms? If not what is the way to display variables from previous form?
4
3609
by: raj_genius | last post by:
I hav two queries, whc are as follows: FIRSTLY: is it possible to access the controls(by name) of a parent form(MDI) from its child forms??if yes then how??plzz provide a coded example in VB if possible.. for example..i hav a menu in the parent form named "Administrator" whic has an item "mnuLogIn"..now when i click on login..another child...
3
1390
by: misra.manisha | last post by:
Hi, I am using frames (I know that its not a good practice, but I have to). Each of these frames have separate form variables, all of which are needed in the parent frame. Now, the problem is that only one frame in the parent frame has a submit button. Is there any way in which I can submit the forms of other frames on click of the...
2
2104
by: justplain.kzn | last post by:
Hi, I have a table with dynamic html that contains drop down select lists and readonly text boxes. Dynamic calculations are done on change of a value in one of the drop down select lists. Using Safari,my first iteration the script works fine ( indicating that there are 33 form variables ). When trying another dropdown select value, the
3
1895
by: BASSPU03 | last post by:
(I'm using Access 2003 on a Windows XP O/S.) I have four tables that are related in the following order: tblFiscalYear > tblBulkObligations > tblProjects > tblResources These are their fields: tblFiscalYear ==========
2
1526
by: gumdealer328 | last post by:
I have multiple forms and in the 2nd form i access some variables and get there values which are added up by the function in the cost class. when i put "Dim TotalCost as New Cost" does that clear the variables in the class? how can i access these variables in other forms without having to reset them?
0
7700
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7614
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8125
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7676
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7974
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.