hello i've learned about codeigniter form validation and i see on this tutorial script form validation like this
private function _validate(){
$data = array();
$data['error_string'] = array();
$data['inputerror'] = array();
$data['status'] = TRUE;
if($this->input->post('post_nama') == ''){
$data['inputerror'][] = 'post_nama';
$data['error_string'][] = 'Nama harus diisi';
$data['status'] = FALSE;
}
if($this->input->post('post_jk') == ''){
$data['inputerror'][] = 'post_jk';
$data['error_string'][] = 'Jenis Kelamin harus diisi';
$data['status'] = FALSE;
}
if($this->input->post('post_alamat') == ''){
$data['inputerror'][] = 'post_alamat';
$data['error_string'][] = 'Alamat harus diisi';
$data['status'] = FALSE;
}
if($data['status'] === FALSE){
echo json_encode($data);
exit();
}
}
my question is, if i want to use limited_number or max_length in that script, where i can place it?
答案 0 :(得分:0)
if( validation ){
$data['inputerror'][] = '';
$data['error_string'][] = '';
$data['status'] = FALSE;
}
添加自己的验证