Readonly Fields - Logic 1.7.24 Minimal theme
Make fields Readonly based on an input or selected logic. For this instance selecting status "Shipped" will make Requireddate and Shippeddate readonly
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")); // Make the 'requiredDate' field readonly when the 'status' is 'Shipped' $xcrud->readonly_logic("requiredDate","status","=","Shipped"); // Make the 'shippedDate' field readonly when the 'status' is 'Shipped' $xcrud->readonly_logic("shippedDate","status","=","Shipped"); // Render the xcrud instance to display the table and form echo $xcrud->render(); ?>