artic69
-
Total Posts
:
2
- Scores: 0
-
Reward points
:
0
- Joined: 3/5/2005
- Location:
-
Status: offline
|
Multiple Select box
Saturday, March 05, 2005 9:15 PM
( permalink)
Can somebody please tell me how to get the value of the selected item in a multiple select box using client side vbscript? Thanks in advance S
|
|
|
|
beaker
-
Total Posts
:
82
- Scores: 0
-
Reward points
:
0
- Joined: 1/27/2005
- Location: USA
-
Status: offline
|
Re: Multiple Select box
Sunday, March 06, 2005 6:25 AM
( permalink)
I did this just today. An example:
<body>
<select id="lstFType" size="1">
<option value="1">Option1
<option value="2">Option2
<option value="3">Option3
</select>
<script language="vbscript>
Dim intNewType
intNewType = lstFType.options (lstFType.selectedIndex).value
</script>
|
|
|
|
artic69
-
Total Posts
:
2
- Scores: 0
-
Reward points
:
0
- Joined: 3/5/2005
- Location:
-
Status: offline
|
Re: Multiple Select box
Sunday, March 06, 2005 7:15 PM
( permalink)
Thanks for you response. This is what the my code after reading your response document.frm.cmbMk.options(cmbMk.selectedIndex).value However, I get a "object required cmbMk" error message. I know cmbMk exists because msgbox document.frm.cmbMk.selectedindex returns the first item selected. This is however not what I want, I want all the items selected. Can you please help? Thanks quote: Originally posted by beaker I did this just today. An example:
<body>
<select id="lstFType" size="1">
<option value="1">Option1
<option value="2">Option2
<option value="3">Option3
</select>
<script language="vbscript>
Dim intNewType
intNewType = lstFType.options (lstFType.selectedIndex).value
</script>
|
|
|
|
beaker
-
Total Posts
:
82
- Scores: 0
-
Reward points
:
0
- Joined: 1/27/2005
- Location: USA
-
Status: offline
|
Re: Multiple Select box
Monday, March 07, 2005 1:50 AM
( permalink)
So you are using a form. As my example shows, I don't use forms and don't know how to use them. I just put controls directly into the document. For testing, you might want to take the <select> element out of the form and see if you can get something more to work. However, this is really an HTML question more than a scripting question.
|
|
|
|
Snipah
-
Total Posts
:
1339
- Scores: 8
-
Reward points
:
0
- Joined: 11/1/2004
- Location: Scotland
-
Status: offline
|
Re: Multiple Select box
Monday, March 07, 2005 2:41 AM
( permalink)
beaker: this is a Scripting q, not an HTML q. VBScript is supposed to read out the multiple values <select id="lstFType" multiple size="3"> I am currently testing it (yet unresolved), but this is VB / JS related
|
|
|
|
beaker
-
Total Posts
:
82
- Scores: 0
-
Reward points
:
0
- Joined: 1/27/2005
- Location: USA
-
Status: offline
|
Re: Multiple Select box
Monday, March 07, 2005 3:30 AM
( permalink)
Oh no, you are right about that, of course. Retrieving the values from the selection list is the scripting part, and handling the <form> submission is the HTML part. We can nail down the scripting syntax by taking the <select> element out of the <form> and just put it in the document. Then if the OP also needs help with the <form> processing, someone who knows how to do that should help.
|
|
|
|
Snipah
-
Total Posts
:
1339
- Scores: 8
-
Reward points
:
0
- Joined: 11/1/2004
- Location: Scotland
-
Status: offline
|
Re: Multiple Select box
Monday, March 07, 2005 4:24 AM
( permalink)
i am well known with JavaScript / VBScript / HTML / DHTML and such, but this has never come across, therefore i see this as a challenge, but still unresolved. If the syntax is known in JS then no doubt there is a way in VBS, it only may take a few extra lines of coding...like attach the selections in a String or an Array [8)]
|
|
|
|
token
-
Total Posts
:
1917
- Scores: 0
-
Reward points
:
0
- Joined: 1/14/2005
- Location:
-
Status: offline
|
Re: Multiple Select box
Monday, March 07, 2005 6:51 AM
( permalink)
Object cmbMK doesn't exist on its own, does it ? quote: I know cmbMk exists because msgbox document.frm.cmbMk.selectedindex
What that means is that "document.frm.cmbMk.selectedindex" returns a value but it has nothing to do with "cmbMk.selectedIndex" I'm not familiar with client-side vbs, but what do you get if you change the line to: document.frm.cmbMk.options(document.frm.cmbMk.selectedindex).value ? I dont' even know if it means anything :P
|
|
|
|