在IE 9中,动态添加的表单元素不是POSTED
我有一个用来做测试的表格。用户输入问题并提供问题类型和答案选项,并保存问题。出现了错误的是,当用户写一个选项并单击一个按钮添加到选项时,选项的文本框的内容将添加到DOM显示为问题的答案。这一切工作正常直到IE9不在那里。
当用户单击添加到选项按钮时,选项显示在DOM中,但值在IE9中不是POSTED。
将选项添加到DOM的函数是
I have a form which is used to make a Test. User enter a question and provides question type and the Answer options and saves the Question. What has gone wrong is that when the user writes one option and click a button for Add to Options the content of the Text Box for the Options are added to the DOM to show as an answer of the Question. This all was working well Until IE9 was not there.
When the user click on the Add to Options Button the Option is shown in the DOM but the value is not POSTED in IE9.
The function which adds the Option to the DOM is
var tbl = document.getElementById('tbl');
var lastRow = tbl.rows.length;
var iteration = lastRow;
var row = tbl.insertRow(lastRow);
arr[ind] = iteration;
var cellLeft1 = row.insertCell(0);
var cellLeft2 = row.insertCell(1);
var cellLeft3 = row.insertCell(2);
if(document.crt_question.test_ans_view[0].checked)
{
if(document.crt_question.test_ans_choice.value=="0") // MCQ with Single Answer (Radio Buttons)
{
var op_val=document.crt_question.test_answer.value;
var words=op_val.split("");
op_val='';
for(i=0;i<words.length;i++)
{
op_val = op_val + words[i].replace('"',"'");
}
cellLeft1.innerHTML = '<div id="button_div'+ind+'" class="dom_"><input type="radio" name="button_'+ind+'" id="button_'+ind+'" value="'+ind+'" ></div>';
cellLeft2.innerHTML = '|<input type="image" src="../../_images/view_del.gif" onclick="return removeRowFromTable('+ ind +')" />|';
var newOption = document.createElement("input");
newOption.name = "test_answer"+ind+"";
newOption.type = "hidden";
newOption.value = op_val;
var newOption2 = document.createElement("input");
newOption2.name = "view_option"+ind+"";
newOption2.type = "text";
newOption2.value = op_val;
cellLeft3.appendChild(newOption);
cellLeft3.appendChild(newOption2);
ind++;
remove++;
}
}
添加选项的表是
The Table to which the Options are added is
<table id="tbl" border="0" style="padding-left:70px;">
<tr>
<td align="left"></td>
<td align="left" ></td>
<td align="left"></td>
</tr>
</table>
在Top函数中,我没有获得隐藏值或输入类型TEXT字段,表单为SUBMITTED。这是工作在FF和IE8。任何人都可以得到这个东西?
In the Top function i do not get the Value of either of the Hidden value or the Input Type TEXT field when the form is SUBMITTED. This is working in FF and IE8. Any one can get on this thing?
注意:这段代码运行在通过IFRAME包含的文件。
NOTE: This code is running in a file which is included through an IFRAME.
这个问题完全是由于IE9标准。在兼容性视图中,错误已删除。所以如果任何一个遇到这种类型的问题只需添加以下行在您的文档的头部分:< meta http-equiv =X-UA-Compatiblecontent =IE = 8 />
That issue was totally due to the IE9 Standards. In the compatibility view the error was removed. So if any one comes across this type of issue just add the following line in the head section of your document: <meta http-equiv="X-UA-Compatible" content="IE=8" />