var checkboxValue = "";
$("input:checkbox[name='mortgage']:checked").each(function() { // 遍历name=mortgage的多选框
if (checkboxValue == 0) {
checkboxValue = $(this).val();
return true;
}
checkboxValue += ',' + $(this).val();
});
if(checkboxValue == null || checkboxValue == ""){
Feng.error("请至少选择一个抵押方式 !");
return false;
}
data.field.mortgage = checkboxValue;
回显
// 获取详情信息,填充表单
var ajax = new $ax(Feng.ctxPath + "/productInfo/editProductInfoDetail?id="+ Feng.getUrlParam("id"));
var c = ajax.start();
var mortgage = new Array();
var result = c.data.mortgage.split(",");
// 遍历复选框已选中的数据 渲染复选框
for (var i = 0; i < result.length; i++) {
var a = result[i];
$("input:checkbox[value='" + result[i] + "']").attr("checked", true);
}
form.render();
delete c.data.mortgage;
form.val('productInfoForm', c.data);