Field Formular
/String 1.7.25 Default theme
Set formular on fields. Edit a record, input firstname and see as Assigned Email is generated.
HIDE CODE
<?php // Get an instance of the Xcrud class $xcrud = Xcrud::get_instance(); // Set the table to work with $xcrud->table("employees"); // Define which columns to display in the table // These columns will be shown in the table view $xcrud->columns("lastName,firstName,extension,email,officeCode"); // 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("lastName,firstName,extension,email,officeCode"); // Set up a relation between the 'officeCode' field in the 'employees' table // and the 'officeCode' and 'city' fields in the 'offices' table $xcrud->relation("officeCode", "offices", "officeCode", "city"); // Set up a dynamic formula for the 'email' field // When the 'onmouseout' event is triggered on the 'firstName' field, // the 'email' field will be populated with a concatenated and lowercased string // Format: firstName.toLowerCase() + "." + lastName.toLowerCase() + "@myoffice.com" $xcrud->set_formular( "email", '"{firstName}".toLowerCase() + ".{lastName}@myoffice.com".toLowerCase();', "onmouseout", "firstName" ); // Make the 'email' field readonly // This means the 'email' field cannot be edited by the user $xcrud->readonly("email"); // Change the label of the 'email' field to 'Assigned Email' $xcrud->label("email", "Assigned Email"); // 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(); ?>
Employees
Add Export into CSV Print Search
# | Lastname | Firstname | Extension | Assigned Email | Officecode | |
---|---|---|---|---|---|---|
1 | Bonduraaaaaaa | Gerard2 | x540 | gbondur@classicmodelcars.com | NYC | View Edit Remove |
2 | Bow | Anthony8 | x5428 | abow@classicmodelcars.com | San Francisco | View Edit Remove |
3 | Jennings | Leslie | x540 | ljennings@classicmodelcars.com | Tokyo | View Edit Remove |
4 | Thompson | Leslie | x4065 | lthompson@classicmodelcars.com | San Francisco | View Edit Remove |
5 | Firrelli | Julie | x2173 | jfirrelli@classicmodelcars.com | Boston | View Edit Remove |
6 | Patterson | Steve | x4334 | spatterson@classicmodelcars.com | Boston | View Edit Remove |
7 | Tseng | Foon Yue | o224 | ftseng@classicmodelcars.com | View Edit Remove | |
8 | Vanauf | George N | x4102 | gvanauf@classicmodelcars.com | NYC | View Edit Remove |
9 | Bondur | Loui | x6493 | lbondur@classicmodelcars.com | Paris | View Edit Remove |
10 | Hernandez | Gerard | x2028 | ghernande@classicmodelcars.com | Paris | View Edit Remove |
?>