-
......all I want to do is "read" thru a combobox in ASP and "response.write" each and every option within that combobox - selected or not!!
In VB I do something like this and it works - how can I do this in ASP.
'VB CODE - it "reads" thru the combo/listbox and prints each item....
Private Sub Command1_Click()
Dim n As Integer
For n = 0 To 3
Combo1.ListIndex = n
Print Combo1.Text
Next
End Sub
I have posted a thread called "Please - this cannot be so difficult" which explains this in detail and no-one seems to be able to help.
Please, anyone, help.
Thanks,
T
-
When a form is submitted, only it's selected options are passed.
If you need to send them all, you will have to create a hidden select tag that is passes along with the form that mirrors the data in the other combo, OR on submit, loop through the options collection of the select tag, and put them into a comma or other delimited hidden textbox.
-
Hi (again) Monte96,
The comma delimited hidden textbox seems to be the answer. The "problem" is that the user can select anything from 1 to 500 options...(I dont really know whether that IS actually a problem...).
Could you please help me with some example code of doing this. Firstly how to create the comma delimited textbox and secondly how to RETRIEVE whatever is in there, in my SECOND page.
Thanks a lot,
T
-
lets see.....
I'm assuming you already know how to create the hidden textbox.. that's just simple html..
Doing this from memory, but I think this should do it:
Code:
MyForm_onsubmit()
{
var colOptions = MyForm.MyCombo.options;
var intList;
var strOptions = new String("");
strOptions = colOptions[0].value
for(intList=1; intList < colOptions.length; intList++)
{
strOptions = strOptions + ', ' + colOptions[intList].value
}
MyForm.MyHiddenTextbox.value = strOptions
}