|
-
Apr 11th, 2001, 12:46 AM
#1
Thread Starter
Member
I have a multiple select list box that is enabled and disabled by a Checkbox, what I want to be able to do is clear out an pre-selected items after the box has been disabled. At the minute when I re-enable the box the prevoiusly selected items are still showing as being selected.
The code I'm trying to use is.
<input type="checkbox" name="chk1" value="chk1" onClick="if (chk1.checked) document.frmMethods.EG.disabled=true; else document.frmMethods.EG.disabled=false; ">
<select name="EG" size="4" multiple onChange="if (EG.disabled) EG.selectedIndex=0;">
Thanks
-
Apr 13th, 2001, 01:20 PM
#2
Frenzied Member
Check out my response in this thread.
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
-
Apr 16th, 2001, 07:39 PM
#3
Thread Starter
Member
-
Apr 16th, 2001, 08:26 PM
#4
Frenzied Member
Wierd.. I copied and pasted it right from the URL line.. it looks like the entire thread got deleted...
I'll dig up my code and repost it for ya...
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
-
Apr 18th, 2001, 02:18 PM
#5
Frenzied Member
Ok.. first off, I'm unclear whether you really want to 'clear' the listbox or just un-select the selected items so I'll post both:
Code:
//Remove all items from a listbox
//Javascript
var colOptions = frmMyForm.lstMyList.options;
var intList;
for (intList=colOptions .length-1; intList > -1; intList--)
colOptions .remove(intList);
'-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
'VBScript
Dim colOptions
Dim intList
Set colOptions = frmMyForm.lstMyList.options
For intList=colOptions.length-1 to 0 Step -1
colOptions.remove(intList)
Next
Set colOptions = Nothing
'-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
//Javascript
//Unselect any selected Items
var colOptions = frmMyForm.lstMyList.options;
var intList;
for (intList=0;intList<colOptions .length; intList++)
if (colOptions[intList].selected)
colOptions[intList].selected=false;
'-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
'VBScript
Dim colOptions
Dim intList
Set colOptions = frmMyForm.lstMyList.options
For intList=0 to colOptions.length
If colOptions(intList).selected Then
colOptions(intList).selected=False
End If
Next
Set colOptions = Nothing
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
-
Apr 22nd, 2001, 05:54 PM
#6
Thread Starter
Member
Thank-you, I wanted to unselect the items.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|