How to use a form two commit button in CI framework? Excuse me, everyone!
The code is as follows:
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 |
$js 1 = ' onmousemove= '. " Showtip (' Select the order to be confirmed, confirm the order, we will do the work for your cargo operation '). ' onclick= ' doconfirm () ';
$js 2 = ' onclick=subship () ';
?>
"class=" button > Add New Order
Reply to discussion (solution)
Try to judge an event
You add two buttons directly, then bind the point-and-click event, and then process the submission form.
$ ("#confirmbtn"). Click (function () {
var checklist = [];
$ ("[name= ' checkbox[]"). each (function () {
if ($ (this). attr ("checked")) {
Checklist.push ($ (this). Val ());
}
});
if (Checklist.length = = 0) {
Alert ("You have not selected the order, please select, then confirm the order");
}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 ("You have not selected the order, please select, then Ship");
}else{
$ ("#form1"). attr ("Action", "index.php?module=order&view=oper_order&operl=2");
$ ("#form1"). Submit ();
}
});