sirbounty
asked on
HTA / HTML help - How to clear a drop down list (remove ALL items)
I'm dynamically generating a table in my script code that creates a cell with a text box, using the following...
<INPUT TYPE=text NAME=txtTargetServer SIZE=25 OnKeyUp=""UpdateTargetServ er"" onBlur=""UpdateTargetDrive s"" TITLE=""Enter the target server name only."">
When the text value is entered, the onBlur event fires and the drop down (which calls a wmi query to get the server's volume) is correctly populated.
However, if I revisit that field and change the server, it's not properly clearing the options in the drop down.
As a test, I entered msgbox lines and it comes up as 0 for the length after the while/wend loop, but the data is still there - do I have to refresh the list somehow?
I've also tried this loop, which fails to ever hit (it's after the while/wend)
For Each objOption in TargetVolumes.Options
objOption.RemoveNode
Next
<INPUT TYPE=text NAME=txtTargetServer SIZE=25 OnKeyUp=""UpdateTargetServ
When the text value is entered, the onBlur event fires and the drop down (which calls a wmi query to get the server's volume) is correctly populated.
However, if I revisit that field and change the server, it's not properly clearing the options in the drop down.
As a test, I entered msgbox lines and it comes up as 0 for the length after the while/wend loop, but the data is still there - do I have to refresh the list somehow?
I've also tried this loop, which fails to ever hit (it's after the while/wend)
For Each objOption in TargetVolumes.Options
objOption.RemoveNode
Next
msgbox TargetVolumes.Options.Length
While TargetVolumes.Options.Length > 0
TargetVolumes.Options.Remove(0)
Wend
msgbox TargetVolumes.Options.Length
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanx Rob - it appears it's my goof.
I'd publicly declared an array to hold those volumes...wasn't clearing it out...
I'd publicly declared an array to hold those volumes...wasn't clearing it out...
Ah cool. Good find. Thanks for the grade.
Regards,
Rob.
Regards,
Rob.
ASKER