Inline Editing (Parsley Validation) Tailwind CSS theme
Inline Editing while doing validation using parsely validator
HIDE CODE
<?php
$xcrud = Xcrud::get_instance();
$xcrud->table('employees');
$xcrud->table_name('Employees - Single click cell to edit!');
$xcrud->set_attr('lastName',array('id'=>'user','data-role'=>'admin'));
//Activate parslet validation
$xcrud->parsley_active(true);
//Make extension mandatory
$xcrud->set_attr('extension',array('required'=>'required'));
//Ensure First Name is alpha numeric
$xcrud->set_attr('firstName',array('data-parsley-trigger'=>'change','required'=>'required','id'=>'user','data-parsley-type'=>'alphanum'));
$xcrud->set_attr('lastName',array('data-parsley-trigger'=>'change','required'=>'required','id'=>'user','data-parsley-type'=>'alphanum'));
//ensure valid email and display "Email not valid"
$xcrud->set_attr('email',array('data-parsley-trigger'=>'change','id'=>'user','data-parsley-type'=>'email',
'data-parsley-error-message'=>"Email not valid"));
//ensure office Code is between 3 and 5 number characters
$xcrud->set_attr('reportsTo',array('id'=>'user','data-parsley-type'=>'digits','data-parsley-length'=>"[3,5]"));
$xcrud->relation('officeCode','offices','officeCode','city');
$xcrud->fields_inline('lastName,firstName,extension,email,officeCode,reportsTo,jobTitle');//set the fields to allow inline editing
$xcrud->set_logging(true);
echo $xcrud->render();
?>
Employees - Single click cell to edit!
| # | Lastname | Firstname | Extension | Officecode | Reportsto | Jobtitle | ||
|---|---|---|---|---|---|---|---|---|
| 1 | Murphys | Diane | 234 | james@classicmodelcars.com | NYC | 1232 | President | View Edit Remove |
| 2 | Patterson | Mary | x324 | mpatterso@classicmodelcars.com | London | 10090 | VP Sales | View Edit Remove |
| 3 | Firrelli | Jeff | x9273 | gbondur@classicmodelcars.com | London | 1002 | VP Marketing | View Edit Remove |
| 4 | Patterson | 123 | x4645 | wpatterson@classicmodelca.com | London | 1056 | Sales Manager (APAC) | View Edit Remove |
| 5 | Bondur | Gerard2 | x540 | gbondur@classicmodelcars.com | NYC | 1050 | Sale Manager (EMEA) | View Edit Remove |
| 6 | Bow | Anthony8 | x5428 | abow@classicmodelcars.com | San Francisco | 1056 | Sales Manager (NA) | View Edit Remove |
| 7 | Jennings | Leslie | x540 | ljennings@classicmodelcars.com | Tokyo | 1143 | Sales Rep 2 | View Edit Remove |
| 8 | Thompson | Leslie | x4065 | lthompson@classicmodelcars.com | San Francisco | 1143 | Sales Rep 3 | View Edit Remove |
| 9 | Firrelli | Julie | x2173 | jfirrelli@classicmodelcars.com | Boston | 1143 | Sales Rep | View Edit Remove |
| 10 | Patterson | Steve | x4334 | spatterson@classicmodelcars.com | Boston | 1143 | Sales Rep | View Edit Remove |