Field Formular
/Disabled Logic NEW
A field is disabled when value changes to above 1000
HIDE CODE
<?php // Get an instance of the Xcrud class $xcrud = Xcrud::get_instance(); // Set the table to work with $xcrud->table("orderdetails"); // Define which columns to display in the table // These columns will be shown in the table view $xcrud->columns("orderNumber,productCode,orderLineNumber,quantityOrdered,priceEach,total"); // Define which fields are available for data entry or editing // These fields will be shown in the form view for adding/editing records $xcrud->fields("orderNumber,productCode,orderLineNumber,quantityOrdered,priceEach,total"); // Set up a relation between the 'officeCode' field in the 'orderdetails' table // and the 'officeCode' and 'city' fields in the 'offices' table $xcrud->relation("officeCode", "offices", "officeCode", "city"); // Set up a dynamic formula for the 'total' field // When the 'onmouseout' event is triggered on the 'quantityOrdered' or 'priceEach' fields, // the 'total' field will be calculated as quantityOrdered * priceEach and rounded to one decimal place $xcrud->set_formular( "total", 'parseFloat({quantityOrdered}*{priceEach}).toFixed(1)', "onmouseout", "quantityOrdered,priceEach" ); //When total is above 1000 the field totoal become disabled $xcrud->disable_logic("total","total",">","1000"); // Render the Xcrud instance to display the table and form // This will output the HTML needed to display the table and form on the web page echo $xcrud->render(); ?>
xCRUDUnknown column 'orderdetails.total' in 'field list'
SELECT `orderdetails`.`orderNumber` AS `orderdetails.orderNumber` ,`orderdetails`.`productCode` AS `orderdetails.productCode` ,`orderdetails`.`orderLineNumber` AS `orderdetails.orderLineNumber` ,`orderdetails`.`quantityOrdered` AS `orderdetails.quantityOrdered` ,`orderdetails`.`priceEach` AS `orderdetails.priceEach` ,`orderdetails`.`total` AS `orderdetails.total` ,`orderdetails`.`id` AS `primary_key` FROM `orderdetails` LIMIT 0,10