關於input 中 hidden屬性在后台作用的實例



在雙模的項目中,我遇到了一個問題,我公司的雙模項目是基於ECShop的框架,在完成訂單列表的頁面時,我寫了兩個form表單來單獨傳輸數據,第一個表單是用來做搜素的,第二個表單是用來顯示表單信息的,在控制器中我並不是用index方法來渲染這個頁面的,這是這個問題的關鍵,我用的是同一個控制器下的productionOrderList方法,所以在第一個form表單里,我需要傳連個東西,分別是 app act。下面就來看看我的具體代碼吧

 <!--  搜索表單  -->
    <form name='form' method='get' style="padding-bottom:15px;">
        <input type="hidden" name="app" value="{$smarty.get.app}"/> //關鍵所在
        <input type="hidden" name="act" value="{$smarty.get.act}"/>//關鍵所在
        <table width='98%'  border='0' cellpadding='1' cellspacing='1' bgcolor='#cfcfcf' align="center" style="margin-top:8px">
            <tr bgcolor='#f8f8f8'>
                <td align='left'><table border='0' cellpadding='0' cellspacing='0' height="32">
                    <tr>

                        <td style="padding: 0px 0px 4px 3px;">
                            <input name="order_type" type="hidden" id="order_type" value="{$smarty.get.order_type}" />
                            訂單號:<input name="order_sn" type="text" id="order_sn" value="{$smarty.get.order_sn}" />
                            &nbsp;商品名稱:<input name="goods_name" type="text" id="goods_name"  value="{$smarty.get.goods_name}" />
                            &nbsp;生產編號:<input name="production_sn" type="text" id="production_sn"  value="{$smarty.get.production_sn}" />&nbsp;
                            工藝說明:<input name="craft_name" type="text" id="craft_name"  value="{$smarty.get.craft_name}" />
                            <br>
                            &nbsp;下單時間:<input name="s_time" type="text" id="begin_add_time" value="{$smarty.get.begin_add_time}" />
                            - &nbsp;<input name="e_time" type="text" id="end_add_time" value="{$smarty.get.end_add_time}" />
                            &nbsp;
                            <!--聯系方式:<input name="phone_mob" type="text" id="phone_mob"  value="{$smarty.get.phone_mob}" />-->
                            {if $smarty.get.order_type}
                            &nbsp;門店篩選:
                            <select name="store_name" id="store_name">
                                <option value=''>選擇門店</option>
                                {foreach from=$store_name item=store_name}
                                <option value='{$store_name}' {if $smarty.get.store_name eq $store_name}selected{/if}>{$store_name}</option>
                                {/foreach}
                            </select>
                            {/if}
                            {if $smarty.get.order_type}
                            &nbsp;服務訂單<select name="wf_status" id="wf_status">
                            <option value=''>全部訂單</option>
                            <option value=11 {if $smarty.get.wf_status eq 11}selected{/if}>待付款</option>
                            <option value=1  {if $smarty.get.wf_status eq 1}selected{/if}>待服務</option>
                            <option value=2   {if $smarty.get.wf_status eq 2}selected{/if}>服務中</option>
                            <option value=3  {if $smarty.get.wf_status eq 3}selected{/if}>已服務</option>
                        </select>
                            {else}
                            &nbsp;生產狀態:
                            <select name="status" id="status">
                                <option value='all'>全部狀態</option>
                                <option value='0' {if $smarty.get.status eq '0'}selected{/if}>取消訂單</option>
                                <option value='10' {if $smarty.get.status eq '10'}selected{/if}>已接單</option>
                                <option value='11' {if $smarty.get.status eq '11'}selected{/if}>待審核</option>
                                <option value='20' {if $smarty.get.status eq '20'}selected{/if}>生產中</option>
                                <option value='30' {if $smarty.get.status eq '30'}selected{/if}>生產完成</option>
                                <option value='31' {if $smarty.get.status eq '31'}selected{/if}>質檢完成</option>
                                <option value='40' {if $smarty.get.status eq '40'}selected{/if}>已出庫</option>
                                <option value='50' {if $smarty.get.status eq '50'}selected{/if}>訂單完成</option>
                                <!--<option value='deleted' {if $smarty.get.status eq 'deleted'}selected{/if}>用戶已刪除</option>-->
                                <!--
                                <option value=''>待退貨</option>
                                <option value=''>已退貨</option>
                                <option value=''>已退款</option>
                                 -->
                            </select>
                            {/if}
                            &nbsp;&nbsp;<input class="np" type="image" src="templates/images/button_search.gif" width="60" height="22" border="0" style="vertical-align: top; margin-top: 3px;" />
                        </td>
                     </tr>
                </table></td>
            </tr>
        </table>
    </form>
    <!--  內容列表   -->
    <form name="form2" class="submitForm" action="index.php?app=craft_order&productionOrderList" load="index.php?app=craft_order&act=drop_craft">
        <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#D6D6D6">
            <tr>
                <td height="28" colspan="12" background="{res file=images/tbg.gif}">
                    <table width='96%' cellpadding='0' cellspacing='0'>
                        <tr>
                            <td height="28" background="/manager/templates/images/tbg.gif" style="padding-left:10px;" colspan="3"> ◆工藝及客戶管理&nbsp;&gt;&nbsp;生產管理列表 &nbsp;</td>
                            <!--<td align='right'>-->
                                <!--<a href="index.php?app=craft&act=addCraft" class='np coolbg'>增加工藝</a>-->
                            <!--</td>-->
                        </tr>
                    </table>
                </td>
            </tr>
            <tr align="center" bgcolor="#f8f8f8" height="25">
                <td width="3%">選擇</td>
                <td width="10%">訂單信息</td>
                <td width="5%">生產編號</td>
                <td width="10%">商品名稱</td>
                <td width="7.5%">工藝說明</td>
                <td width="4%">數量</td>
                <td width="12.5%">提單時間</td>
                <td width="12.5%">生產日期</td>
                <td width="12.5%">質檢時間</td>
                <td width="5%">質檢結果</td>
                <td width="5%">生產狀態</td>
                <td width="10%">操作</td>
            </tr>
            <!--{if !empty($orderList)}-->
            <!-- {foreach from=$orderList item=item name=list} -->
            <tr align="center" bgcolor="#FFFFFF" height="26" align="center" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';">
                <td class="list-text">
                    <input name='id[]'  type='checkbox'  class="chooseNow"  value='{$item.id}' />
                </td>
                <td>
                    {$item.order_sn|default:-}
                </td>
                <td>
                    {$item.production_sn|default:-}
                </td>
                <td>
                    {$item.goods_name|default:-}
                </td>
                <td>
                    {$item.craft_name|default:-}
                </td>
                <td>
                    {$item.user_goods_total|default:-}
                </td>
                <td>{if $item.add_time!=''}{$item.production_time|date:Y-m-d H:i:g}{else}--{/if}
                </td>
                <td>{if $item.production_time!=''}{$item.production_time|date:Y-m-d H:i:g}{else}--{/if}
                </td>
                <td>{if $item.production_end_time!=''}{$item.production_end_time|date:Y-m-d H:i:g}{else}--{/if}

                </td>
                <td>
                    {$item.qualityTestingChinese|default:-}
                </td>
                <td>
                    {if $item.statusChinese}{$item.statusChinese}
                    {else}--
                    {/if}
                </td>
                <td width="" class="list-text">
                    <div class="lista">
                        <a href="index.php?app=craft&act=addCraft&id={$item.id}">查看</a>
                        {if $item.status==10}<span>|</span><a href="index.php?app=craft&act=addCraft&id={$item.id}">隨工單</a>{/if}
                        {if $item.status==40}<span>|</span><a onclick="member_delete({$item.id})" href="javascript:;">更改結算</a>
                        {/if} </div>
                </td>
            </tr>
            <!--{/foreach}-->
            <tr bgcolor="#ffffff">
                <!--<td height="36" colspan="12">&nbsp; <a class="coolbg" id="checkAll" href="javascript:;">全選</a> <a class="coolbg" id="unCheck" href="javascript:;">取消</a> <a class="coolbg" id="printing" href="javascript:;">&nbsp;打印&nbsp;</a> <a class="coolbg" id="unCheck" href="javascript:;">取消</a></td>-->
                <td height="36" colspan="12">
                    <a href="javascript:;" id="checkAll" class="coolbg">全選</a>
                    <a href="javascript:;" id="unCheck" class="coolbg">取消</a>
                    <a href="javascript:;" id="print_all" class="coolbg">打印</a>
                    <a href="javascript:;" id="export_all" class="coolbg">導出</a>
                    <a href="javascript:;" id="export_condition" class="coolbg" title="導出上面篩選條件的所有訂單">條件導出</a>
                    {if $site_config.store_info.store_id==267321 ||$site_config.store_info.store_id==254451 || $site_config.store_info.store_id==257417}
                    <a href="javascript:;" id="export_goods" class="coolbg" title="導出上面篩選條件的商品匯總單">
                        條件導出
                    </a>
                    {/if}
                    <a href="javascript:;" id="batch_hide" class="coolbg">批量刪除</a>
                    <a href="javascript:;" id="batch_print_all" class="coolbg">批量打印隨工單</a>
                </td>
            </tr>
            <!--{else}-->
            <tr align="right" bgcolor="#f8f8f8">
                <td height="36" colspan="12" align="center"><span>您的數據為空</span></td>
            </tr>
            <!--{/if}-->
            <tr bgcolor="#f8f8f8">
                <td height="36" colspan="12" align="center">
                    {$pageShow}
                </td>
            </tr>
        </table>
    </form>
</div>

這兩行代碼就是重點

  <input type="hidden" name="app" value="{$smarty.get.app}"/> //關鍵所在
        <input type="hidden" name="act" value="{$smarty.get.act}"/>//關鍵所在

沒有這兩個傳輸的話,點擊搜索是沒有效果的

本地項目在http://m.123.local.qushiyun.com/manager/index.php?app=craft_order&act=productionOrderList

感想:現在遇到的問題都是在為日后成為大神而添加的瓦片
注:本文來源於我雨中笑之個人的簡書https://www.jianshu.com/p/cf56475a58b5,轉載請申明來源


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM