Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deselect values in list boxes

Status
Not open for further replies.

tulsantide

Technical User
Jun 1, 2015
21
0
0
US
Hi,

I have 3 list boxes and whenever I select a value in one list box the values in the other 2 list boxes should be deselected in case if any of them are selected. Please let me know your suggestions. I already posted this on vbscript forum but I didn't get any response

I wrote the following, which is not working. I'm populating the values in the select boxes during window load
===========================================================================
<!DOCTYPE html>

<html>

<head>
<HTA:APPLICATION
APPLICATIONNAME = "Test Project"
BORDER = "Thick"
INNERBORDER = "yes"
MAXIMIZEBUTTON = "no"
MINIMIZEBUTTON = "YES"
SCROLL = "YES"
SHOWINTASKBAR = "Yes"

/>

<title>test project</title>

<SCRIPT LANGUAGE="VBScript">


function Check(intValue)

Select Case intValue

Case 0
For Each objOption in txt1.Options
If objOption.Selected Then
txt2.disabled = true
txt3.disabled = true
Else
txt2.disabled = false
txt3.disabled = false

End If
Next

Case 1

For Each objOption in txt2.Options

If objOption.Selected Then

txt1.disabled = true
txt3.disabled = true

Else
txt1.disabled = false
txt3.disabled = false

End If
Next
Case 2

For Each objOption in txt3.Options

If objOption.Selected Then
txt1.disabled = true
txt2.disabled = true

Else
txt1.disabled = false
txt2.disabled = false

End If
Next
End Select

End Function
End Sub
</SCRIPT>

</head>

<Body>
<p class="para1"> Select A value txt1 </p><BR><BR>
<select class="txt1" id="txt1" size="2" name=txt1 onchange="Check(0)">

</select><BR><BR>

<p class="para1"> Select A value txt2 </p><BR><BR>
<select class="txt2" id="txt2" size="2" name=txt2 onchange="Check(1)">
</select><BR><BR>

<p class="para3"> Select A value txt3 </p><BR><BR>
<select class="txt3" id="txt3" size="2" name=txt3 onchange="Check(2)">
</select><BR><BR>


</BODY>

</html>
 
3 options - only 1 can be selected.

sounds like radio buttons much ? ^_^

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top