I am a new to codeIgniter and I just got stuck in the very beginning. I am using HMVC extention and while validating I am getting the following error:
Unable to access an error message corresponding to your field name Password.(pword_check)
any help would be greatly appreciated
Code:
public function submit()
{
    $this->load->library('form_validation');
    $this->form_validation->set_rules('username', 'Username', 'required|max_length[30]|xss_clean');
    $this->form_validation->set_rules('pword', 'Password', 'required|max_length[30]|callback_pword_check|xss_clean');
    if ($this->form_validation->run() == FALSE)
    {
        $this->login();
    }
    else
    {
        echo 'Success'; die();
    }
}
public function pword_check($str)
{
    if ($str == 'test')
    {
        $this->form_validation->set_message('pword_check', 'The %s field can not be the word "test"');
        return FALSE;
    }
    else
    {
        return TRUE;
    }
}
                xss_clean is no longer part of form validation in Codeingitore 3
Just remove xss_clean from your validation roul
$this->form_validation->set_rules('pword', 'Password', 'required|max_length[30]|callback_pword_check');
If you really, really need to apply that rule, you should now also load the Security Helper, which contains xss_clean() as a regular function and therefore can be also used as a validation rule.
go to application/config/autoload.php :
$autoload['helper'] = array('security');
Or, before your form validation
$this->load->helper('security');
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With