0

カスタム エラー メッセージにエラーが表示されず、エラー メッセージの代わりに空白ページのみが表示される

ここに私のコントローラがあります:

public function daftar(){
  $this->form_validation->set_rules('email','Email','required');
  $this->form_validation->set_rules('nama','Nama','required');
  $this->form_validation->set_rules('pass','Password','required');
  $this->form_validation->set_rules('passconf','PasswordConf','required|matches[pass]');

  if($this->form_validation->run()==FALSE){
  $this->form_validation->set_message('passconf','the password doesnt match');

 }
 else{
   redirect('lowongan/daftar_employer');
 }

 }

}

4

2 に答える 2

0

「doesn't」という単語のアポストロフィをエスケープする必要があります。

$this->form_validation->set_message('passconf','the password doesn\'t match');
于 2013-08-24T01:47:27.953 に答える
0

カスタム コールバック関数を記述して、独自のエラー メッセージを設定する

callback_custom_error

  $this->form_validation->set_rules('passconf','PasswordConf','required|matches[pass]|callback_custom_error');


public function custom_error($str)
{
    if($this->form_validation->run()==FALSE)
    {
          $this->form_validation->set_message('passconf','your custom message');
          return FALSE;
    }
    else
    {
          return TRUE;
    }

}
于 2013-08-24T08:16:33.370 に答える