Parsley Validation
Do parley validations on the form.
public function parsley_validation()
{
$xcrud = get_xcrud();
$xcrud->table('employees');
$xcrud->set_attr('lastName',array('id'=>'user','data-role'=>'admin'));
//Activate parsley 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('officeCode',array('id'=>'user','data-parsley-type'=>'digits','data-parsley-length'=>"[3,5]"));
$data['content'] = $xcrud->render();
return view('demos', $data);
}
Employees
| # | Lastname | Firstname | Extension | Officecode | Reportsto | Jobtitle | ||
|---|---|---|---|---|---|---|---|---|
| 1 | MUrr | DianeCC | 123 | ty89cvcvthyht@hh.com | 3333 | 855 | President64 | |
| 2 | Gerard | Martin | x2312 | ty89cvcvthyht@hh.com | 123 | Sales Rep | ||
| 3 | Ygy | Ggg | Fgbj7@hj.com | 1233 | 5 | Ff | ||
| 4 | DARA2 | DATRATRE | TANTA | dara@gmail.com | 4 | 454 | GIGIONE | |
| 5 | aaa | bbb dfghjkl | aaa@aa999a.com | 3 | aaa | |||
| 6 | er | ytu | 1 | |||||
| 7 | aa | bb | 3 | |||||
| 8 | ||||||||
| 9 |