codeigniter - Unable to access an error message corresponding to your field name captcha.(captchacheck) -


i ve used solution found here http://www.mahbubblog.com/php/form-validation-callbacks-in-hmvc-in-codeigniter/comment-page-2/#comment-5996. , working on ci 3.0 on mac, when tried deploying site ubuntu server produces "unable access error message corresponding field name captcha.(captchacheck)". please help...

thanks

function index(){   $this->load->library('form_validation');   $this->form_validation->set_rules('username', 'user name', 'trim|required|min_length[4]|xss_clean');   $this->form_validation->set_rules('firstname', 'first name', 'trim|required|min_length[4]|xss_clean');   $this->form_validation->set_rules('lastname', 'last name', 'trim|required|min_length[4]|xss_clean');   $this->form_validation->set_rules('email', 'your email', 'trim|required|valid_email');   $this->form_validation->set_rules('password', 'password', 'trim|required|min_length[4]|max_length[32]');   $this->form_validation->set_rules('password2', 'password confirmation', 'trim|required|matches[password]');   $this->form_validation->set_rules('country', 'country', 'trim|required|min_length[4]|xss_clean');   $this->form_validation->set_rules('company', 'company', 'trim|required|min_length[4]|xss_clean');   $this->form_validation->set_rules('captcha', 'captcha', 'trim|strip_tags|callback_captcha_check|match_captcha[captcha.word]');   $data = $this->get_data_from_post();     if ($this->form_validation->run($this) === false){        $data['image'] = $this->captcha_model->create_image();        $data['view_file'] = 'registration';        $data['js']="";        $data['module'] = 'users';        $this->load->module('template');        $this->template->site($data);      }     else{        $data2 = $this->get_data_from_post();        $this->db->insert('ict_users',$data2);        $data['view_file'] = 'success';        $data['js']="";        $data['module'] = 'users';        $this->load->module('template');        $this->template->site($data);      }  }  function captcha_check($value){     if($value==''){         $this->form_validation->set_message('captcha_check','please enter text image');         return false;     }     else{         return true;      } } 

please remove  match_captcha[captcha.word] need use callback below given  public function validate_captcha(){     if($this->input->post('captcha') != $this->session->userdata['captcha'])     {         $this->form_validation->set_message('validate_captcha', 'wrong captcha code, hmm terminator?');         return false;     }else{         return true;     }  } 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -