Hide Fields-Logic 1.7.24 Bootstrap 4.5 theme
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 | 20.10.2003 00:00:00 | 27.10.2003 00:00:00 | 24.10.2003 00:00:00 | ffdfd | View Edit Remove | |
| 2 | 21.10.2003 00:00:00 | Shipped | 30.10.2003 00:00:00 | 23.10.2003 00:00:00 | Questo ordine è stato contestato, ma risolto | View Edit Remove |
| 3 | 22.10.2003 00:00:00 | Shipped | 31.10.2003 00:00:00 | 26.12.2003 00:00:00 | This order was on hold because customers's credit | View Edit Remove |
| 4 | 21.10.2003 00:00:00 | Shipped | 30.10.2003 00:00:00 | 27.10.2003 00:00:00 | View Edit Remove | |
| 5 | 23.10.2003 00:00:00 | 30.10.2003 00:00:00 | Customer called to cancel. The warehouse was | View Edit Remove | ||
| 6 | 28.10.2003 00:00:00 | Shipped | 03.11.2003 00:00:00 | 01.11.2003 00:00:00 | View Edit Remove | |
| 7 | 04.11.2003 00:00:00 | Shipped | 14.11.2003 00:00:00 | 09.11.2003 00:00:00 | View Edit Remove | |
| 8 | 04.11.2003 00:00:00 | Shipped | 12.11.2003 00:00:00 | 07.11.2003 00:00:00 | View Edit Remove | |
| 9 | 05.11.2003 00:00:00 | Shipped | 13.11.2003 00:00:00 | 07.11.2003 00:00:00 | View Edit Remove | |
| 10 | 05.11.2003 00:00:00 | Shipped | 14.11.2003 00:00:00 | 11.11.2003 00:00:00 | View Edit Remove |