CodeIgniter - Unable to access an error message corresponding to your field name Password.(pword_check)
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');
Hello Guys I found the solution for working with call_backs in hmvc codeIgniter.I would like to post the solution for others.
Solution:
1. Create MY_Form_validation.php file in libraries folder and paste following code in it.
if (!defined('BASEPATH')) exit('No direct script access allowed'); class MY_Form_validation extends CI_Form_validation { function run($module = '', $group = '') { (is_object($module)) AND $this->CI = &$module; return parent::run($group); }}
- And change
if ($this->form_validation->run() == FALSE)
toif ($this->form_validation->run($this) == FALSE)
thats all folks..
public function pword_check($str){ if ($str == 'test') { $this->form_validation->set_message( __FUNCTION__ , 'The %s field can not be the word "test"'); return FALSE; } else { return TRUE; }}
// Its working well