473,398 Members | 2,088 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,398 software developers and data experts.

How do I reference this select?

Hi, I am trying to reference this select:

<form id="form3" method="post" action="exceptions.php">
<input type="hidden" name="id" value="<?php p($course->id) ?
>" />
<input type="hidden" name="grade_itemid" value="<?php
p($selectedgrade_item) ?>" />
<input type="hidden" name="sesskey" value="<?php p($USER-
>sesskey) ?>"/>
<input type="hidden" name="action" value="excepts" />
<select name="members[]" size="15" multiple="multiple">

I am trying to get to "members[]". I have this:

getElementById('form3')['members[]'].length = username.length;

but it doesn't work.

Thank you for any help.

Aug 10 '07 #1
4 1617
On Aug 10, 1:03 pm, jmDesktop <needin4mat...@gmail.comwrote:
Hi, I am trying to reference this select:

<form id="form3" method="post" action="exceptions.php">
<input type="hidden" name="id" value="<?php p($course->id) ?>" />

<input type="hidden" name="grade_itemid" value="<?php
p($selectedgrade_item) ?>" />
<input type="hidden" name="sesskey" value="<?php p($USER->sesskey) ?>"/>

<input type="hidden" name="action" value="excepts" />
<select name="members[]" size="15" multiple="multiple">

I am trying to get to "members[]". I have this:

getElementById('form3')['members[]'].length = username.length;

but it doesn't work.

Thank you for any help.

I am assuming that you want to find out the number of options in the
select element.
getElementById('form3')['members[]'].options.length =
username.length;

Note the "options"

Hendri Kurniawan

Aug 10 '07 #2
On Aug 10, 1:18 pm, Hendri Kurniawan <hckurnia...@gmail.comwrote:
[...]
I am assuming that you want to find out the number of options in the
select element.
getElementById('form3')['members[]'].options.length =
username.length;

Note the "options"
Why? The select element itself has a length property which is equal to
the number of options.

<URL: http://www.w3.org/TR/DOM-Level-2-HTM...tml#ID-5933486 >
--
Rob

Aug 10 '07 #3
On Aug 10, 2:10 pm, RobG <rg...@iinet.net.auwrote:
On Aug 10, 1:18 pm, Hendri Kurniawan <hckurnia...@gmail.comwrote:
[...]
I am assuming that you want to find out the number of options in the
select element.
getElementById('form3')['members[]'].options.length =
username.length;
Note the "options"

Why? The select element itself has a length property which is equal to
the number of options.

<URL:http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-5933486>

--
Rob
Hmm you are right. never tried that before. Always options...
Well I should revoke my answer then.

I'm now GUESSING that the elements returned from
getElementById('form3')['members[]']
is actually an array of elements (by where he have multiple
'members[]' elements.

Hendri Kurniawan

Aug 10 '07 #4
On Aug 10, 2:56 pm, Hendri Kurniawan <hckurnia...@gmail.comwrote:
On Aug 10, 2:10 pm, RobG <rg...@iinet.net.auwrote:
On Aug 10, 1:18 pm, Hendri Kurniawan <hckurnia...@gmail.comwrote:
[...]
I am assuming that you want to find out the number of options in the
select element.
getElementById('form3')['members[]'].options.length =
username.length;
Note the "options"
Why? The select element itself has a length property which is equal to
the number of options.
<URL:http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-5933486>
--
Rob

Hmm you are right. never tried that before. Always options...
Well I should revoke my answer then.

I'm now GUESSING that the elements returned from
getElementById('form3')['members[]']
is actually an array of elements (by where he have multiple
'members[]' elements.
No need to guess, read the spec:

"Returns the Element whose ID is given by elementId. If no such
element exists, returns null. Behavior is not defined if more than one
element has this ID."

<URL: http://www.w3.org/TR/DOM-Level-2-Cor...ml#ID-getElBId >

getElementById should not return more than one element, though if more
than one element has the same ID (which would be invalid for HTML), it
seems the first will be return though I wouldn't ever depend on that.

If the element is a select, then it will have an options property,
which is an HTML collection (NodeList), not an Array.

<URL: http://www.w3.org/TR/DOM-Level-2-HTM...ml#ID-30606413 >
--
Rob

Aug 10 '07 #5

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

Similar topics

5
by: malcolm | last post by:
Example, suppose you have these 2 tables (NOTE: My example is totally different, but I'm simply trying to setup the a simpler version, so excuse the bad design; not the point here) CarsSold {...
7
by: Wolfgang Kreuzer | last post by:
Hello all, I have two tables - Projects and ProjectStruct Table Projects contains master records of the projects, ProjectStruct allows to define a project herarchie and contains the fields...
2
by: David Zuckerman | last post by:
I'm developing an ASP.NET solution, and one of the things I need to do is to have it return system information for various servers on our network. I wanted to do this using the various methods of...
11
by: Just Me | last post by:
I have a solution containing many usercontrol projects. When I wish to reference a usercontrol in another project I can select either the project or the assembly. Does it make a difference which...
4
by: Supra | last post by:
I am doing irc chat similar to mirc chat if i connected to irc.webamster.com i had no problem. but if connected to eu.undernet.org. i got error....somthing bug me! O:-) 'February 2004 'An...
8
by: ST | last post by:
Hello everyone, Can anyone help me with this error above when I debug my web app project in vstudio.net?? I can't figure it out! It was working fine for months, and now all of a sudden it's not!!...
1
by: Tony Johansson | last post by:
Hello! I use C# and VS 2003 My exe file is using several class dll(assume we called then 1,2,3,4,5,6) and some of these 6 class dll is using some of the other 5 class dll. If I have a class...
5
by: Michael Russell | last post by:
Hi all, Using C#, I've created a simple wrapper class for using Excel. I have Office Pro 2003 installed on my devel machine. The wrapper class works great, reading and writing to/from Excel. ...
5
by: No bother | last post by:
I am using 5.0.26-NT on Windows 2000. I have need to use a reference in the outer from clause in a subquery in the select clause. Consider the following example: Select (select b.baitID from...
6
by: jan.schaak | last post by:
hi, this is my sql code. -----start code----- SELECT Reeksen.ReeksNR, Reeksen.ReeksText, Count(Strips.Titel) AS NBTitel, (SELECT Count(strips.Titel) AS AantalVanTitel FROM (Reeksen INNER...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.