<div class="form-body">
<iframe class="hide" id="iForms_FRAME" name="iForms_FRAME"></iframe>
<!--自定义表单的表单-->
<form action="<!--{iCMS:router url='forms'}-->" id="aaaaaaaaaaaa"
class="form-inline" method="post" target="iForms_FRAME">
<!--表单结构-->
<!--{iCMS:forms:create formid="表单ID"}-->
<div class="mb10"></div>
<div class="form-actions">
<button class="btn btn-lg btn-primary" type="submit">
<i class="fa fa-check"></i> 提 交
</button>
</div>
</form>
<!--自定义表单提交脚本 可以自己写-->
<script>
$(function(){
$("#aaaaaaaaaaaa").submit(function(){
event.preventDefault();
var me = $(this);
var param = me.serialize();
$.post("<!--{iCMS:router url='forms'}-->", param,
function(ret) {
if(ret.code){
me.html('<div class="alert alert-success" role="alert">'+ret.msg+'</div>');
}else{
if(ret.forward){
$("#"+ret.forward.id).focus();
}
iCMS.UI.alert(ret.msg);
}
}
,'json');
return false;
});
});
</script>
</div>
样式自己调整
表单结构自定义
<!--{iCMS:forms:create formid="表单ID" layout="false"}-->
其它字段只要name跟自定义的一样就可以
示例:
<div class="form-body">
<!--自构表单-->
<form action="<!--{iCMS:router url='forms'}-->" method="post">
<!--{iCMS:forms:create formid="表单ID" layout="false"}-->
<!--表单结构-->
<input id="自定义表单字段1" name="自定义表单字段1" type="text" class="form-control" value="" />
<input id="自定义表单字段2" name="自定义表单字段2" type="text" class="form-control" value="" />
<input id="自定义表单字段3" name="自定义表单字段3" type="text" class="form-control" value="" />
<div class="form-actions">
<button class="btn btn-lg btn-primary" type="submit">
<i class="fa fa-check"></i> 提 交
</button>
</div>
</form>
</div>
评论