我需要生成两种类型的字段,带有特定的标签<form:input>
并<form:hidden>
从 JS 动态生成。第一个<form:input>
应该是输入字段,第二个必须隐藏。问题是它<form:input>
不被识别为输入并且根本没有显示。但是从页面源代码中可以看出。
if (bank != null) {
var fields = bank.additionalFields;
var additionalRows = document.getElementById("additionalRows");
for (i = 0; i < fields.length; i++) {
//from here generates jsp inputs:
//1 - <form:input>
//2 - <form:hidden> for each element from fields
var formInput = document.createElement("form:input");
var formHidden = document.createElement("form:hidden");
formInput.setAttribute("path", "paymentInfo.fields[" + i + "].value");
formHidden.setAttribute("path", "paymentInfo.fields[" + i + "].id");
formInput.setAttribute("type", "text");
formHidden.setAttribute("type", "text");
formInput.setAttribute("value", "");
formHidden.setAttribute("value", fields[i].id);
additionalRows.appendChild(formInput);
additionalRows.appendChild(formHidden);
}
}
<form:input>
从 JSP 生成的其他字段正确显示在页面上。生成页面源码链接>> https://dl.dropboxusercontent.com/u/106355152/form_input.PNG
怎么解决?