OK, I've got a form that I dynamically change the contents of via javascript with commands like
That's all good for regular select fields.
The problem is, I want to do this for a field of the type
(allows user to hold CTRL and select multiple options)
The problem is that this now breaks the Javascript used to rewrite the form. Like this, I get
I get
I get
Anybody know the proper way to approach this?
Alternately, is there a way to get all the values in PHP without adding that "[]" to the select name? doing $_POST["selectfieldname"] without the "[]" in the form gives me only one selected item, and it's not an array that I can parse with a foreach() or whatever.
Code:
document.forms.formname.selectfieldname.options.length = 0
The problem is, I want to do this for a field of the type
Code:
<select multiple name="selectfieldname[]">
The problem is that this now breaks the Javascript used to rewrite the form. Like this, I get
If I change the javascript to'document.forms.formname.selectfieldname.options' is null or not an object
Code:
document.forms.formname.selectfieldname[].options.length = 0
and if I trysyntax error
Code:
document.forms.formname.selectfieldname[0].options.length = 0
'document.forms.formname.selectfieldname.0' is null or not an object
Anybody know the proper way to approach this?
Alternately, is there a way to get all the values in PHP without adding that "[]" to the select name? doing $_POST["selectfieldname"] without the "[]" in the form gives me only one selected item, and it's not an array that I can parse with a foreach() or whatever.