Disable Fields - Logic 1.7.24

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
106.11.2003 00:00:00Shipped14.11.2003 00:00:0015.11.2003 00:00:00 View Edit Remove
206.11.2003 00:00:00Shipped15.11.2003 00:00:0012.11.2003 00:00:00 View Edit Remove
308.11.2003 00:00:00Shipped16.11.2003 00:00:0010.11.2003 00:00:00Custom shipping instructions sent to warehouse View Edit Remove
412.11.2003 00:00:00Shipped19.11.2003 00:00:0015.11.2003 00:00:00 View Edit Remove
512.11.2003 00:00:00Shipped21.11.2003 00:00:0018.11.2003 00:00:00 View Edit Remove
613.11.2003 00:00:00Shipped22.11.2003 00:00:0015.11.2003 00:00:00We need to keep in close contact with their… View Edit Remove
714.11.2003 00:00:00Shipped22.11.2003 00:00:0020.11.2003 00:00:00 View Edit Remove
814.11.2003 00:00:00Shipped21.11.2003 00:00:0020.11.2003 00:00:00 View Edit Remove
914.11.2003 00:00:00Shipped20.11.2003 00:00:0018.11.2003 00:00:00888 They want to reevaluate their terms agreement… View Edit Remove
1015.11.2003 00:00:00Shipped24.11.2003 00:00:0016.11.2003 00:00:00 View Edit Remove
Search