• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Use validation for a variable in controller or modal ci-4

#1
hi sorry for english,

I want to use validation library for a email validation in controller manuel method ex. $validation->setRules(or all database request automatic method protected $validationRules protected $validationMessages in modal.

I have a $email variable . But I cant check this.what way ı should follow.


I try this



in modal 

protected $validationRules    = [
  'eposta'        => 'required|valid_email',
  'pass'    => 'required|min_length[8]'
];
protected $validationMessages = [
  'cari_eposta'        => [
      'valid_email' => 'Sorry. That email has already been taken. Please choose another.'
  ],
  'cari_sifre'        => [
      'min_length' => 'Sorry. That email has already been taken. Please choose another.'
  ]
];


It's problem its checking only insert,save and update.


In Controller I try this

$validation =  \Config\Services::validation();
$validation->setRules([
  'eposta'        => 'required|valid_email',
  'pass'    => 'required|min_length[8]'
]);


problem : I dont know use  this rules for $email in controller.

I dont want to problem solution with use post method and use form. I have only variable check with validation .
Sercan YANBULOGLU
SEO links REDACTED, per forum policy
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.