- 注册时间
- 2015-11-12
- 最后登录
- 2021-12-3
- 阅读权限
- 10
- 积分
- 77
- 精华
- 0
- 帖子
- 10
|
业务需要在表单内使用juqery去添加表单内的行
function addrow(){
$("#testtable").append("<tr>"+
"<td class=\"mini-form-label\" style=\"width:8%;\">" +
"<label>"+
" 货物类别:" +
"</label>"+
"</td>"+
" <td colspan=\"1\" style=\"width:17%;\">"+
"<span class=\"mini-textbox\" style=\"border-width: 0px;\"><span class=\"mini-textbox-border\"><input type=\"text\" class=\"mini-textbox-input\" autocomplete=\"off\" placeholder=\"\" name=\"jhorderline[1].product\">"+
"</span><input type=\"hidden\"></span> " +
"</td>"+
"<td class=\"mini-form-label\" style=\"width:8%;\">"+
"<label>"+
"货物名称:"+
"</label>"+
"</td>"+
" <td colspan=\"1\" style=\"width:17%;\">"+
"<span class=\"mini-textbox\" style=\"border-width: 0px;\"><span class=\"mini-textbox-border\"><input type=\"text\" class=\"mini-textbox-input\" autocomplete=\"off\" placeholder=\"\" name=\"jhorderline[1].goodsName\">"+
"</span><input type=\"hidden\"></span> " +
"</td>"+
"<td class=\"mini-form-label\" style=\"width:8%;\">"+
" <label>"+
" 货物重量:"+
" </label>"+
" </td>"+
" <td colspan=\"1\" style=\"width:17%;\">"+
"<span class=\"mini-textbox\" style=\"border-width: 0px;\"><span class=\"mini-textbox-border\"><input type=\"text\" class=\"mini-textbox-input\" autocomplete=\"off\" placeholder=\"\" name=\"jhorderline[1].qty\">"+
"</span><input type=\"hidden\"></span> " +
"</td>"+
"<td class=\"mini-form-label\" style=\"width:8%;\">"+
" <label>"+
" 货物数量:"+
" </label>"+
" </td>"+
" <td colspan=\"1\" style=\"width:17%;\">"+
"<span class=\"mini-textbox\" style=\"border-width: 0px;\"><span class=\"mini-textbox-border\"><input type=\"text\" class=\"mini-textbox-input\" autocomplete=\"off\" placeholder=\"\" name=\"jhorderline[1].weight\">"+
"</span><input type=\"hidden\"></span> " +
"</td>"+
"</tr>");
}
表单内容
<table style="width:100%;height:95%;table-layout:fixed;" class="mini-form-table" id="testtable">
<tr>
<td class="mini-form-label" style="width:8%;">
<label>
货物类别:
</label>
</td>
<td colspan="1" style="width:17%;">
<input class="mini-textbox" name="jhorderline[0].product"/>
</td>
<td class="mini-form-label" style="width:8%;">
<label>
货物名称:
</label>
</td>
<td colspan="1" style="width:17%;">
<input class="mini-textbox" name="jhorderline[0].goodsName"/>
</td>
<td class="mini-form-label" style="width:8%;">
<label>
货物重量:
</label>
</td>
<td colspan="1" style="width:17%;">
<input class="mini-textbox" name="jhorderline[0].qty"/>
</td>
<td class="mini-form-label" style="width:8%;">
<label>
货物数量:
</label>
</td>
<td colspan="1" style="width:17%;">
<input class="mini-textbox" name="jhorderline[0].weight"/>
</td>
</tr>
</table>
但是在获取form表单时,无法获取到新添加的数据
{"jhorderrelease":{"id":"","shipmentNo":"","no":"","urgency":"","customerName":"","organizationCode":"","consignor":"","platformCompany":"","originphone":"","deliverydate":"","deliveryday":"","expecteddate":"","expectedday":"","startport":"","startportaddr":"","startportdetaddr":"","startportcontract":"","startportmobile":"","endport":"","endportaddr":"","endportdetaddr":"","endportcontract":"","endportmobile":"","mileage":"","sellUnitPrice":"","sellTotalPrice":"","sellSettleMethod":"","buyTotalPrice":"","sellSettleEx":""},"jhorderline":[{"product":"1","goodsName":"2","qty":"3","weight":"4"}]}
添加数据时只固定添加了一条数据,但是获取只能获取表单上一开始存在的数据
function saveData(){
var form2 = new mini.Form("#订单录入");
console.log(form2.getData(false,true));
}
想请教一下应该如何处理才能取到数组数据
|
|