All Forums >> [Scripting] >> WSH & Client Side VBScript >> Urgent Help On VBScript Combo Boxes Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Posts: 1
Score: 0
Joined: 4/2/2004
From: USA
Status: offline
Hi,
I have a webpage with a combo box(drop down) and two items (A and B). On the onChange() event of this combo box I am calling a vbscript function selVal() to select a value in another combo box. I have already populated(using HTML) the other combo box with 4 items (Select from this box...., Me, Myself and I - with 'Select from this box...' selected by default)
Now what the function should do is that if I select 'A' from the first combo box it should display 'Me' in the other combo box and If I select 'B' from the first combo box it should select 'Select from this box....' in the second combo box and allow me to select from the items in the combo box.
HTML Code
first combo box: ----------------
second combo box: ----------------
VBScript Code: -------------- Sub selVal() Dim dfrm1, firstVal
Set dfrm1 = document.form1 //set document.form to a variable firstVal = UCASE(dfrm1.firstCombo.Value)
Select Case firstVal Case "A" dfrm1.secondCombo.options(dfrm1.secondCombo.SelectedIndex).text = "Me" dfrm1.secondCombo.options(dfrm1.secondCombo.SelectedIndex).value = "10"
Case "B" dfrm1.secondCombo.options(dfrm1.secondCombo.SelectedIndex).text = "Select from this box...." dfrm1.secondCombo.options(dfrm1.secondCombo.SelectedIndex).value = " "
Case Else dfrm1.secondCombo.options(dfrm1.secondCombo.SelectedIndex).text = "Select from this box...." dfrm1.secondCombo.options(dfrm1.secondCombo.SelectedIndex).value = " "
End Select End Sub
But its not giving me the necessary functionality. Please try and help.
Hi, hello. you must use same name for id and name of object (ucase or other) . and you must use id in your form and .... such as this sample. you can tell me by email.pedram@supportlock.com
If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.