<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                > 萬能表單跟留言模塊(message)是相關聯的,下面我就來詳細介紹如何使用萬能表單功能 留言表單 ~~~ <form action="{fun U('message/index')}" onsubmit="return checkform()" method="POST"> <input name="tid" type="hidden" value="{$type['id']}" > <div class="form-group"><label>*您的稱呼</label><input name="user" id="user" class="form-control" type="text"></div> <div class="form-group"><label>*您咨詢的問題</label><input name="title" id="title" class="form-control" type="text"></div> <div class="form-group"><label>*您的手機號</label><input name="tel" id="tel" class="form-control" type="tel"></div> <!--后臺新增的擴展字段在這里輸出--> <span id="ext_fields"></span> <div class="form-group"><label>*問題描述</label><textarea name="body" id="body" class="form-control"></textarea></div> <div class="form-group"><button class="btn btn-primary btn-block" type="submit">確定發送</button></div> </form> <script> function checkform(){ var user = $.trim($("#user").val()); var title = $.trim($("#title").val()); var email = $.trim($("#email").val()); var tel = $.trim($("#tel").val()); var body = $.trim($("#body").val()); if(user==''){ alert('您的稱呼不能為空~');$("#user").focus();return false; } if(title==''){ alert('您的咨詢的問題不能為空~');$("#title").focus();return false; } if(tel==''){ alert('您的手機號不能為空~');$("#tel").focus();return false; } if(body==''){ alert('問題描述不能為空~');$("#body").focus();return false; } return true; } function get_fields(tid,id){ var id = arguments[1]?arguments[1]:0; $.post("{fun U('Common/get_fields')}",{molds:'message',tid:tid,id:id},function(r){ var res = JSON.parse(r); console.log(res); if(res.code==0){ //默認 res.tpl輸出的是layui的模板HTML,可以審核元素查看res里面的內容 //$("#ext_fields").html(res.tpl); var html = ''; var len = res.fields_list.length; if(len>0){ //根據對應的字段,進行HTML設計 for(var i=0;i<len;i++){ if(res.fields_list[i].field=='email'){ html+='<div class="form-group"><label>您的郵箱</label><input name="email" id="email" class="form-control" type="email"></div>'; } } } $("#ext_fields").html(html); } }); } $(document).ready(function(){ get_fields({$type['id']}); }); </script> ~~~ `$.post()`方法返回的`res.tpl`就攜帶了已經格式化的HTML內容,但是這個HTML是基于layui的,所以如果你要使用官方已經給你格式化的HTML,你需要借助layui,當然也可以自己自定義每個字段的輸出HTML格式,也可以自己定制一套輸出HTML的格式,這需要寫個插件方法,覆蓋(或者hook)掉`Home/CommonController.php` 控制器下面的 `get_fields`這個方法
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看