I've got a javascript code which dynamically creates list-boxes in a form. It
works perfectly fine in IE, but in Firefox 2 I change the selected value in
a list-box but nothing gets submitted via POST.
The dynamic list-box creation code looks like this:
[HTML]
<form name="form0" method=POST action="/dynamic/AppDirector/Global/GlobalParameters" onkeypress="return webDefaultFormKeyHandler(this,event,IDN_Conversion _Page_Set_Handler)">
<table border=0>
<tr><td class="varName">
<b>Open New Entry When Source Port Different</b>
</td>
<td class="varValue" id="varValue1">
<input type="hidden" name="mibId_0" value="187">
<script language="JavaScript1.2" type="text/javascript">
var187_0Object = new SelectBox("var187_0","varValue1");
var187_0Object.add("enable","enable");
var187_0Object.add("disable","disable");
var187_0Object.setValue("disable");
</script></td></tr>[/HTML]
SelectBox is defined in another javascript file, and the code goes like this:
Expand|Select|Wrap|Line Numbers
- function SelectBoxSetValue(value) {
- options = this.sel.options;
- for (i=0;i<options.length;i++) {
- if (options[i].value == value) {
- this.sel.selectedIndex = i;
- }
- }
- }
- function SelectBoxAdd(text,value)
- {
- ops = this.sel.options;
- for (i=0;i<ops.length;i++) {
- if (ops[i].text == text) {
- return;
- }
- }
- o = document.createElement("OPTION");
- o.text = text;
- o.value = value;
- addoption(this.sel,o);
- }
- function SelectBox(name,parentId) {
- this.sel = document.createElement("SELECT");
- this.sel.name = name;
- this.sel.id = name;
- if (parentId != null) {
- this.par = document.getElementById(parentId);
- } else {
- this.par = document;
- }
- this.add = SelectBoxAdd;
- this.remove = SelectBoxRemove;
- this.setValue = SelectBoxSetValue;
- this.par.appendChild(this.sel);
- }
Thanks in advance