Heim > Backend-Entwicklung > PHP-Tutorial > 求助!CI框架中如何使用一个form两个提交按钮?

求助!CI框架中如何使用一个form两个提交按钮?

WBOY
Freigeben: 2016-06-23 14:11:10
Original
1160 Leute haben es durchsucht

求教,CI框架中如何使用一个form两个提交按钮呢?麻烦各位了!
代码如下:
<script> <br /> $(document).ready(function() { <br /> $('#fileData').dataTable( { <br /> "aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]], <br /> "sPaginationType": "full_numbers", <br /> "aaSorting": [[ 0, "desc" ]], <br /> "iDisplayLength": <?php echo ROWS_PER_PAGE; ?>, <br /> "bJQueryUI": true, <br /> "sDom": '<"H"frlT><"clear">t<"clear"><"F"ip>', <br /> //<"H"T><"clear"> <br /> //"sDom": '<"top"i>rt<"bottom"flp><"clear">', <br /> 'bProcessing' : true, <br /> 'bServerSide' : true, <br /> 'sAjaxSource' : '<?php echo base_url(); ?>index.php?module=order&view=getdatatableajax', <br /> <br /> 'fnServerData': function(sSource, aoData, fnCallback) <br /> { <br /> $.ajax <br /> ({ <br /> 'dataType': 'json', <br /> 'type' : 'POST', <br /> 'url' : sSource, <br /> 'data' : aoData, <br /> 'success' : fnCallback <br /> }); <br /> }, <br /> "oTableTools": { <br /> "sSwfPath": "smlib/media/swf/copy_csv_xls_pdf.swf", <br /> "aButtons": [ <br /> // "copy", <br /> "csv", <br /> "xls", <br /> { <br /> "sExtends": "pdf", <br /> "sPdfOrientation": "landscape", <br /> "sPdfMessage": "" <br /> }, <br /> "print" <br /> ] <br /> }, <br /> "oLanguage": { <br /> "sSearch": "Filter: " <br /> }, <br /> "aoColumns": [ <br /> { "sClass": "center", "bSortable": false}, <br /> null, <br /> null, <br /> null, <br /> null, <br /> null, <br /> null, <br /> null, <br /> { "bSortable": false } <br /> ], <br /> "aaSorting": [[1, 'asc']] <br /> } ); <br /> <br /> <br /> <br /> } ); <br /> <br /> </script>

<script> <br /> function cc(N,bool){ <br /> var aa = document.getElementById(N).getElementsByTagName("input"); <br /> for (var i=0; i<aa.length; i++){ <br /> if (aa[i].type=="checkbox") <br /> aa[i].checked = bool==1 ? true : (bool==0 ? false : !aa[i].checked); <br /> } <br /> } <br /> <br /> </script>
        



".$message."
"; } ?>






lang->line("list_results"); ?>



    lang->line("all_warehouses"); ?>
foreach($warehouses as $warehouse) {
echo "id."' style='margin: 0px 5px 10px 5px;'>".$warehouse->name."";
}
?>


$attribute_form = array('id' => 'form1' );
?>



        
            
            

            
            
            
            
            

            

        


            

        
lang->line("date"); ?> lang->line("reference_no"); ?> lang->line("ordersn_o"); ?> lang->line("warehouses"); ?> lang->line("shipmethod_o"); ?> lang->line("orderstatus_o"); ?> lang->line("trackingnum_o");?> lang->line("actions"); ?>
Loading data from server

$js1 = 'onmousemove='."showtip('选择要确认的订单,确认订单后,我司将为您的货物进行作业操作')".' onclick="doConfirm()"';
    $js2 = 'onClick=subship()';
?>

   " class="button">添加新订单



    










回复讨论(解决方案)

判断事件试试

你直接加两个按钮,然后绑定点击事件,再去处理提交表单

$("#confirmbtn").click(function () {

                 var checklist = [];

                 $("[name='checkbox[]']").each(function(){
                     if($(this).attr("checked")){
                     checklist.push($(this).val());
                     }
                     });

                 if(checklist.length == 0){
                     alert("您 还 未 选择 订单 ,请 选择 ,然后 确认 订单 ");
                    }else{
                         $("#form1").attr("action","index.php?module=order&view=oper_order&operl=1");

                          $("#form1").submit(); 
                    }

                
                });

                $("#shipbtn").click(function () {

                 var checklist = [];

                 $("[name='checkbox[]']").each(function(){
                     if($(this).attr("checked")){
                     checklist.push($(this).val());
                     }
                     });

                 if(checklist.length == 0){
                     alert("您 还 未 选择 订单 ,请 选择 ,然后 发货 ");
                    }else{
                         $("#form1").attr("action","index.php?module=order&view=oper_order&operl=2");

                          $("#form1").submit(); 
                    }
                    
                });

Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage