• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with form validation sets of Rules

#1
Bug 
I'm using  `form_validation.php` in `application/config/` folder with subs arrays

PHP Code:
$config = array(
'siga_login' => array(
array(    
"field" => 'usuario',
"label" => '"Usuário (Login)"',
"rules" => 'xss_clean|trim|required|min_length[2]|max_length[60]|strtolower'
),    
array(    
"field" => 'senha',
"label" => '"Senha de acesso"',
"rules" => 'xss_clean|trim|required|min_length[4]|max_length[30]'
)
),
 
     // And more ... 
); 


My problem is that method `run()` don't validate using my rules, first I set the data (I know that the default is $_POST, but it's okay)

PHP Code:
$this->form_validation->set_data($_POST);
if(
$this->form_validation->run('siga_login')===FALSE){
// Action if has validate errors
return;
}else{
// It's Okay



I have extended the `Form_validation` but, everthing ok, I just added some new functions.

PHP Code:
class MY_Form_validation extends CI_Form_validation {

private 
$enableCaptcha true;

public function 
__construct($rules=array())
{
parent::__construct($rules);
$ci = &get_instance();
$ci->load->library('recaptcha');
}



And I'm loading in `config/autoload.php`
PHP Code:
$autoload['libraries'] = array('database','session','encryption','form_validation'); 
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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