473,372 Members | 1,073 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,372 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 1615
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.