默认情况下模块表单提交页面是单独的一个页面,而在实际项目中有时候需要把模块表单提交页面放到内容详情页面,这样可以不用跳转到新页面提交表单,而是直接在内容中提交表单。


1、以文章反馈表单为例

image.png

2、在文章内容页面show.html,下面代码中的‘fankui’需要改成你自己的表单别名

{php extract(dr_get_mform_post_value(MOD_DIR, 'fankui',$id))}
<form action="" class="form-horizontal" method="post" name="myform" id="myform">
	{$form}
	<div class="fc-form-body">
		{$myfield}
		{$diyfield}
		{$sysfield}
		{if $is_post_code}
		<div class="form-group">
			<label class="control-label col-md-2">{dr_lang('验证码')}</label>
			<div class="col-md-10">
				<label>
					<div class="form-recaptcha">
						<div class="input-group">
							<input type="text" class="form-control" name="code">
							<div class="input-group-btn fc-code">
								{dr_code(120, 35)}
							</div>
						</div>
					</div>
				</label>
			</div>
		</div>
		{/if}
	</div>

	<div class="portlet-body form myfooter">
		<div class="form-actions text-center">
			<button type="button" onclick="dr_ajax_submit('{$post_url}', 'myform', '2000', '{$rt_url}')" class="btn green"> <i class="fa fa-save"></i> 提交内容</button>
		</div>
	</div>
</form>

3、然后预览文章页就有了!