Forum Moderators: open
I'm using PHP to parse returned selected options which means I need to end the select input name with '[]'
This then breaks my javascript which complains about the name ending with [].
(If I remove the [] from the input name the javascript works but then not the PHP).
How do i get around this problem in Javascript?
Cheers
<form name="test_multiple_select_form" method="post"><select name="test_multiple_select[]" multiple="multiple"><option label="one" value="one">one</option>
<option label="two" value="two">two</option>
</select>
</form>
script type="text/javascript">
<!--
function selectAllList() {
var aSelect = document.test_multiple_select_form.test_multiple_select[];
var aSelectLen = aSelect.length;
for(i = 0; i < aSelectLen; i++) {
aSelect.options[i].selected = true;
}
}
-->
</script>
<a href="javascript:selectAllList()" title="select all">select all</a>
HTH
- JS
[endeavorpub.com...]