Home > Article > Backend Development > 求助!CI框架中如何使用一个form两个提交按钮?
求教,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>
lang->line("list_results"); ?>
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 |
判断事件试试
你直接加两个按钮,然后绑定点击事件,再去处理提交表单
$("#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();
}
});