Forum Moderators: open

Message Too Old, No Replies

Get value of Select (Multiple) box

Select (Multiple) issue

         

tabish

11:04 am on Nov 24, 2006 (gmt 0)

10+ Year Member



hello all,

I have two select box, one is single selection box and one s multiple.

when i try to disable Select box (multiple) it gives error, code is here

document.form1.part_city.disabled = true;

while select box is like this

<select name="part_city[]" multiple>

When i try to disable it using document.form1.part_city.disabled = true; i get error "part_city" is not an object.

Please help me.

Regards

Bernard Marx

6:05 pm on Nov 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That's because the element is named,
part_city[b][blue][][/blue][/b]
.

We'll need to use square bracket notation here, since we're dealing with characters that are illegal as properties. So..

document.form1["part_city[]"].disabled = true;

If you have more than one element with this name, you will also have to supply its index:

document.form1["part_city[]"][[blue]n[/blue]].disabled = true;