milov.nl

Interaction design • webdevelopment • web art • photography

milov.nl : forum : coding : '[js] How does one access multiple selected values from combo box'

[js] How does one access multiple selected values from c… JRDN, 020502 03:43
i have a combo box/drop down menu where you can select multiple values, how does one keep track of the values selected?
if combo box variable is named menu,

document.myForm.menu.selected gets me a single value,
can document.myForm.menu.selected be an array of values?
dialup-64.159.101.28.Dial1.Cleveland1.Level3.net
Re: [js] How does one access multiple selected values fr… marc, 020502 12:02
var so = document.Form.select1;
var buffer = "";
for (var i=0; i < so.length; i++){
buffer = buffer + 'text: ' + so.options[i].text + '\n';
buffer = buffer + 'value: ' + so.options[i].value + '\n';
}
alert(buffer);

you might wanna take a look at a sample I have on my website, see the samples page, listbox... http://www.braincast.nl
213-84-199-113.adsl.xs4all.nl
Re: [js] How does one access multiple selected values fr… JRDN, 020502 16:58
It looks like your code is traversing down the listbox/combox outputing each option and its value. My question is when you have a listbox/combo box with the the multiple option selected
eg
<select size=4 multiple><option></option> etc.... </select>
therefore you can ctrl select multiple items at the same time in the listbox, how do you keep track of which items are selected?

if combo box variable is named menu,

document.myForm.menu.selected gets me a single value,
can document.myForm.menu.selected be an array of values?



x84-113-59.lib.umn.edu
Re: [js] How does one access multiple selected values fr… milov, 020502 17:23
Slight adjustment of Marc's script to generate array of selected options:
var so = document.Form.select1; 
selectedOptions = new Array();
for (var i=0; i < so.length; i++){
if (so.options[i].selected)
{
selectedOptions[i] = so.options[i].value;
}
}
 
webkracht.xs4all.nl
Re: [js] How does one access multiple selected values fr… marc, 020502 17:27
How about:

var so = document.MyForm.menu;
var buffer = "";
for (var i=0; i < so.length; i++){
if (so.options[i].selected == true){
buffer = buffer + 'text: ' + so.options[i].text + '\n';
buffer = buffer + 'value: ' + so.options[i].value + '\n';
}
}
alert(buffer);

(how hard can it be?)
213-84-199-113.adsl.xs4all.nl
Re: [js] How does one access multiple selected values fr… marc, 020502 17:28
hehe... milov beat me to it...

213-84-199-113.adsl.xs4all.nl
Re: [js] How does one access multiple selected values fr… JRDN, 020502 20:56
ah, so simple.
thanks
x84-113-59.lib.umn.edu
Re: [js] How does one access multiple selected values fr… yahoo.com,girijaind,girija, 030409 13:07
I have to select values from one table say "module" in the combo which has got more than one value.and based on another field say "no" which has got one or more than one modules in the db master.If i change the no the value of module should come from module db and the value of module in master table should be selected.This i solved it.But how can i make the selected value of the module in the first position in asp code.
202.54.153.21
Re: [js] How does one access multiple selected values fr… Calm_Pear, 030415 21:45
I'm having some trouble trying to understand what you mean...
Do you mean that you want the selections that are allready stored in a database to show up in the select listbox?
Something like:
<%
Do While Not RS.EOF
If RS("boolean") = True Then
Response.Write "<option selected>blah</option>"
Else
Response.Write "<option>blah</option>"

End If
RS.MoveNext
Loop
%>

Is that it??
node-c-66a3.a2000.nl
Re: [js] How does one access multiple selected values fr… hotmail.com,vvs_anand,anand, 030530 15:41
Urgent
202.56.255.38
Re: [js] How does one access multiple selected values fr… kumar, 040123 10:22
Super
202.63.124.1
Re: [js] How does one access multiple selected values fr… kumar, 040123 10:23
fwfhh
202.63.124.1
Re: [js] How does one access multiple selected values fr… aol.com,sahebmhm,Hossein, 040217 21:01
Hi;
in frontpage and asp choosing combo multiple selection why this code is not working? D2 is the name of the combo
dim d2var(10)
for i=0 to 10
d2var(i)=Request.Form("D2")
next

if d2var(0)="1" and d2var(1)="2" then
statment
end if
d2var(0) byitself works fine but when I add "and d2var(1)" it does not recognize it
thanks
66.160.17.162
Re: [js] How does one access multiple selected values fr… Calm_Pear, 040218 00:56
That's because d2var isn't an array yet, you'll need to make an array of it first like so:


<%@ Language=VBScript %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<%
Dim MyArray
D2 = Request("D2")
MyArray = Split(D2, ",")
i = 0
Do Until i = UBound(MyArray) + 1
Response.Write i & ": " & MyArray(i) & "<br />"
i = i + 1
Loop
%>
</body>
</html>
 
node-c-0404.a2000.nl
Re: [js] How does one access multiple selected values fr… yahoo.com,woofy77,woofy77, 040420 08:46
i'm trying to generate an array with the selected values from a combo box. however, I'm using a URL as the value of each option . How can i split this up so i can generate 1 field with all the sub parameters of the URL.eg, 1 field with selected user names, 1 field with holding name, etc.
<select multiple name="selectVp">


<option value="/command.asp?WorkFlowName=VDownload&WorkFlowState=Init&WorkFlowAction=Next.GetVData&RequestedCSV=S&RequestedHoldingIdentifier=<% =arrHoldingIdentifier(i)%>&RequestedProduct=<% =arrProductFamily(i)%>&RequestedCategory=Summary+Details&SubmitRequest=Submit+request&VSPDate= <% =VSPDate%>&UserId= <% =GetField("PlannerClientPortfolioSearch","userId")%>&AdviserSurname= <% =GetField("UserDetails","surname")%>&CustomerPartyId= <% =GetField("Portfolio","CISPartyId")%>";>
<% =arrHoldingName(i)%>&nbsp;-&nbsp;<% =arrHoldingIdentifier(i)%>&nbsp;&nbsp;</option>

sydch01.aust.csc.com
How does one access multiple selected values from combo b… yahoo.com,sach_dhumal2002,Sachin, 040512 08:52
hi,
i have a problem, I am doing on task in which i access multiple
selected values from one combo and inserting in another combo .
So how can i insert multiple values in combo.
proxy1.cdacindia.com
Re: [js] How does one access multiple selected values fr… sachin, 040512 09:15
very urgent
proxy1.cdacindia.com
Re: [js] How does one access multiple selected values fr… P01, 040512 12:21
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/option.html

You have everything you need in the manual
AAmiens-106-1-22-192.w81-51.abo.wanadoo.fr
Re: [js] How does one access selected values from combo … anne, 050215 07:56
i want to display the selected value from the combo box
210.18.72.218.sify.net
Re: [js] How does one access selected values from combo … anne, 050215 07:57
i want to display the selected value from the combo box
210.18.72.218.sify.net
Re: [js] How does one access multiple selected values fr… sebi, 050427 11:59
canany one help me with the same problem i want to store the multiple selection in the database.I am using the 3 tier architechture. In which the combox has been written in the jsp and the value of it is stored in the form bean so how will i know in the action which value has been selected.
pls reply soon.
host36.mumbai.tcs.co.in
Re: [js] How does one access multiple selected values fr… Calm_Pear, 050427 18:06
better start a new thread sebi... (I know nothing about beans other then the ones you can eat)
h103091.upc-h.chello.nl
Re: [js] How does one access multiple selected values fr… Milo, 050427 18:13
I'm used to people mean "Javascript" when saying "Java", but I don't often see a *Java*-developer confuse Java with Javascript. :)
81.23.239.48
Re: [js] How does one access multiple selected values fr… sebi, 050429 16:21
well Calm_pear the person who does not know my question will tell that only and Milo well i know java script and java very well

well regarding my question i want to ask that i am using 3 tier architechture (if any one has used before) and in that i am using a jsp for front end in which i have a combo box in which a person can select multiple selection. when that page is submitted it goes to the controller ( in my case Struts framework) which decide which should be the next file it should go( depending on the result) well when we submit the page it goes to the delegate in which we are capturing the exceptions. it ten goes to the session( ie the buissness logic) which directs it to the Data access object (DAO) which forms the connection with the data base and runs the query and depending on the results the controller will decide which should be next page.
well for the multiple selection how will i come to know which options are selected and mind you i am using java also.

reply soon and if only you have any answer.

host36.mumbai.tcs.co.in
Re: [js] How does one access multiple selected values fr… sebi, 050510 13:23
well no answer for my question how rude
host36.mumbai.tcs.co.in
Re: [js] How does one access multiple selected values fr… Milo, 050510 13:39
I guess nobody here knew the answer, sebi... Not surprising considering you posted this in a Javascript (not Java) thread.
81.23.239.48
Pages: 1