Welcome Guest, Not a member yet? Register   Sign In
Validation Form

(This post was last modified: 05-08-2020, 04:16 AM by Bary.)

I have a problem with the validation of the form. that it is an insertion, it works but for the modification, it does not work. here is the code for the model
PHP Code:
'email' => 'required|valid_email|is_unique[employee.email,employee_id,{employee_id}]',
'matricule' => 'required|is_natural|is_unique[employee.matricule,employee_id,{employee_id}]'
PHP Code:
if($emp->validate($this->request->getPost()) === FALSE) {
   $msg $emp->errors();
   return redirect()->to(site_url('form'))->with('errors',$msg);

and the error on update:
PHP Code:
The email field must contain a unique value.
The matricule field must contain a unique value
Thank you.  Smile

Can you show us the $_POST data and database layout?
Are you on 4.0.3, as it's the first version with validation placeholders other than Model.
What database server are you using?

(This post was last modified: 05-18-2020, 05:18 AM by Bary.)

Hi, Thank's for your answer, here is the post : 

PHP Code:
array(26) { ["employee_id"]=> string(1"7" ["nom"]=> string(4"Test" ["prenom"]=> string(3"gdm" ["titre"]=> string(1"2" ["date_naissance"]=> string(10"2020-05-07" ["situation_fam"]=> string(1"2" ["matricule"]=> string(1"5" ["nbre_enfants"]=> string(1"1" ["nbre_enfant_declare"]=> string(1"1" ["cin"]=> string(15"123 345 567 789" ["date_cin"]=> string(10"2020-05-25" ["lieu_cin"]=> string(9"Analavory" ["adresse"]=> string(6"Itaosy" ["ville"]=> string(4"Tana" ["telephone"]=> string(9"329876543" ["email"]=> string(14"[email protected]["num_cnaps"]=> string(8"12345678" ["date_embauche"]=> string(10"2020-05-04" ["date_debauche"]=> string(10"0000-00-00" ["direction_id"]=> string(1"3" ["fonct_id"]=> string(1"1" ["salaire_base"]=> string(4"2000" ["class_id"]=> string(1"1" ["btn_submit"]=> string(11"Enregistrer" ["dir_current"]=> string(1"1" ["funct_current"]=> string(1"1" 

i use the latest version(4.0.3) and mysql.

Theme © iAndrew 2016 - Forum software by © MyBB