INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Deselect values in list boxes

Deselect values in list boxes

(OP)
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>

RE: Deselect values in list boxes

3 options - only 1 can be selected.

sounds like radio buttons much ? ^_^

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close