<script>
$(document).ready(function () {
var num=document.getElementsByTagName("input").length;
$("#AddMoreTextBox").click(function (e)
{
num++;
$("#add").append('<div>' +
'<input type="text" name="model_type" placeholder="模型类型" class= "form-input" validate="required"/>' +
'<input type="text" name="model_value" placeholder="模型值" class=" form-input" validate="required"/>' +
'<input type="text" name="model_desc" placeholder="描述" class="form-input" validate="required"/>' +
'<a href="#" class="removeclass"><input type=\'button\' value=\'删除\'></a></div>');
});
$("body").on("click",".removeclass", function(e) { //user click on remove text
if (num > 1) {
$(this).parent('div').remove(); //remove text box
num--; //decrement textbox
}
})
});
</script>
<div class="page-header">
<h1>
产品模型
<small>
<i class="ace-icon fa fa-angle-double-right"></i>
<span class="form-head">新增</span>
</small>
</h1>
</div><!-- /.page-header -->
<div class="row">
<div class="col-xs-12">
<!-- PAGE CONTENT BEGINS -->
<form class="form-horizontal" role="form" method="post" action="${base}/product/model/add">
模型详情列表:<a href="#" id="AddMoreTextBox" >添加输入框</a>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">模型名称</label>
<div class="col-sm-9">
<input type="text" name="model_name_one" placeholder="模型名称" class="col-sm-5 form-input" validate="required"/>
</div>
</div>
<div class="form-group" id="add" >
</div>
<div class="clearfix form-actions">
<div class="col-md-offset-3 col-md-9">
<button class="btn btn-white btn-info form-submit" type="button">
<i class="ace-icon fa fa-check bigger-110"></i>
提交
</button>
<button class="btn btn-white" type="reset">
<i class="ace-icon fa fa-undo bigger-110"></i>
重置
</button>
</div>
</div>
</form>
</div>
</div>
@At
@POST
@RequiresPermissions("product.model.add")
@Desc("产品模型.添加")
@Ok(HtmlViewMaker.VIEW_JSON)
public Object add(@Param("..") List<ProductModel> productmodel,@Param("model_name_one")String model_name) throws AlertException {
System.out.println(Json.toJson(productmodel));
System.out.println(model_name);
//dao.insert(productmodel);
return Result.ok();
}