Disable Fields - Logic NEW

Hide fields based on an input or selected logic. For this instance selecting status "Shipped" will disable 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"));

    // Disable the 'requiredDate' field when the 'status' is 'Shipped'
    $xcrud->disable_logic("requiredDate","status","=","Shipped");

    // Disable the 'shippedDate' field when the 'status' is 'Shipped'
    $xcrud->disable_logic("shippedDate","status","=","Shipped");

    // Render the xcrud instance to display the table and form
    echo $xcrud->render();	
?>

Orders

#OrderdateStatusRequireddateShippeddateComments
Actions
129.03.2003 00:00:00Shipped19.03.2003 15:48:4111.03.2003 00:00:00Customer requested that FedEx Ground is used for… View Edit Remove
218.03.2003 00:00:00Shipped24.03.2003 00:00:0020.03.2003 00:00:00 View Edit Remove
325.03.2003 00:00:00Shipped31.03.2003 00:00:0030.03.2003 00:00:00 View Edit Remove
424.03.2003 00:00:00Shipped03.04.2003 00:00:0029.03.2003 00:00:00Customer requested that ad materials (such as… View Edit Remove
526.03.2003 00:00:00Shipped02.04.2003 00:00:0027.03.2003 00:00:00 View Edit Remove
601.04.2003 00:00:00Shipped24.04.2003 00:00:0002.04.2003 00:00:00 View Edit Remove
704.04.2003 00:00:00Shipped12.04.2003 00:00:0007.04.2003 00:00:00 View Edit Remove
811.04.2003 00:00:00Shipped19.04.2003 00:00:0013.04.2003 00:00:00 View Edit Remove
916.04.2003 00:00:00Shipped24.04.2003 00:00:0017.04.2003 00:00:00 View Edit Remove
1021.04.2003 00:00:00Shipped29.04.2003 00:00:0026.04.2003 00:00:00Customer has worked with some of our vendors in… View Edit Remove
Search