Hide Fields-Logic NEW
Hide fields based on an input or selected logic. For this instance selecting status "Shipped" will hide Requireddate and Shippeddate
HIDE CODE
<?php // Get an instance of the Xcrud class $xcrud = Xcrud::get_instance(); // Set the table to work with $xcrud->table("orders"); // Define which columns to display in the table $xcrud->columns("orderDate,status,requiredDate,shippedDate,comments"); // Define which fields are available for data entry or editing $xcrud->fields("orderDate,status,requiredDate,shippedDate,comments"); // Change the input type of the 'status' field to a select dropdown and provide options $xcrud->change_type("status","select","",array("Not Shipped"=>"Not Shipped","Shipped"=>"Shipped","Completed"=>"Completed")); // Hide the 'requiredDate' field when the 'status' is 'Shipped' $xcrud->hide_logic("requiredDate","status","=","Shipped"); // Hide the 'shippedDate' field when the 'status' is 'Shipped' $xcrud->hide_logic("shippedDate","status","=","Shipped"); // Render the xcrud instance to display the table and form echo $xcrud->render(); ?>
Orders
# | Orderdate | Status | Requireddate | Shippeddate | Comments | |
---|---|---|---|---|---|---|
1 | 29.03.2003 00:00:00 | Shipped | 19.03.2003 15:48:41 | 11.03.2003 00:00:00 | Customer requested that FedEx Ground is used for | View Edit Remove |
2 | 18.03.2003 00:00:00 | Shipped | 24.03.2003 00:00:00 | 20.03.2003 00:00:00 | View Edit Remove | |
3 | 25.03.2003 00:00:00 | Shipped | 31.03.2003 00:00:00 | 30.03.2003 00:00:00 | View Edit Remove | |
4 | 24.03.2003 00:00:00 | Shipped | 03.04.2003 00:00:00 | 29.03.2003 00:00:00 | Customer requested that ad materials (such as | View Edit Remove |
5 | 26.03.2003 00:00:00 | Shipped | 02.04.2003 00:00:00 | 27.03.2003 00:00:00 | View Edit Remove | |
6 | 01.04.2003 00:00:00 | Shipped | 24.04.2003 00:00:00 | 02.04.2003 00:00:00 | View Edit Remove | |
7 | 04.04.2003 00:00:00 | Shipped | 12.04.2003 00:00:00 | 07.04.2003 00:00:00 | View Edit Remove | |
8 | 11.04.2003 00:00:00 | Shipped | 19.04.2003 00:00:00 | 13.04.2003 00:00:00 | View Edit Remove | |
9 | 16.04.2003 00:00:00 | Shipped | 24.04.2003 00:00:00 | 17.04.2003 00:00:00 | View Edit Remove | |
10 | 21.04.2003 00:00:00 | Shipped | 29.04.2003 00:00:00 | 26.04.2003 00:00:00 | Customer has worked with some of our vendors in | View Edit Remove |