2012-09-25 4 views
0

이것은 set_rules가 current_password을 찾도록 지시 받았을 때 괴롭 히며, current-password을 찾는다 고 말하면 아직 작동하지 않습니다.set_rules() not

<input type="password" name="current_password" id="current_password" value=""/> 

name과 id에는 모두 밑줄이 있습니다. 나도 그것을 변경하는 경우

$this->form_validation->set_rules('current_password', 'Password', 'required|callback_check_password['.$user_id.']'); 
//This gives me 
Unable to access an error message corresponding to your field name. 

위의 규칙이 작동 실 거예요 아직 set_rules('current-password'가 시작 오류 메시지를 보여줍니다. 내가 콜백 함수에서 오류 메시지가 설정되지 않은 array(1) { ["current_password"]=> string(4) "test" }

+0

내가 콜백 경우 모르는를 보여줍니다 'callback_check_password [ '. $ user_id.']' – manix

+0

다른 매개 변수를 전달 중입니다. 허용 된 것입니다. – Bankzilla

+0

콜백 함수에서 필드 메시지를 어떻게 설정합니까? – manix

답변

0

게시물의 덤프를하는 <?php echo validation_errors(); ?>

인쇄 오류 메시지가

function check_password($password, $user_id){ 
    $check = $this->Usermodel->check_password($password, $user_id); 
    if($check){ 
     return TRUE; 
    } else { 
     $this->form_validation->set_message('check_password', 'Incorrect password'); 
     return FALSE; 
    } 
}