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


1、以文章反馈表单为例

image.png

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

{php extract(dr_get_mform_post_value(MOD_DIR, 'fankui',$id))}
<p>调试信息:{$debug}</p>
<form action="{$post_url}&is_show_msg=1" 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"> AJAX提交(需要手动加载官方js库)</button>
    <button type="submit" class="btn green"> 普通提交</button>

</div>
</div>
</form>
调试信息:{$debug}

注意ajax提交需要加载官方js库https://www.xunruicms.com/doc/627.html


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


文档最后更新时间:2021-10-14 19:49:40
我来修改此文档(1) 不会操作怎么办?