Note the upgraded forum! If you are experiencing issues logging in, you may need to reset your password which should send an email. If the email doesn't arrive, be sure to check your spam folder just in case.

Unable to access an error message corresponding to your field name Resume.

edited February 15 in News & Announcements
HI
I have written an validation rule on MY_Form_validation class under application -> library folder
as follow ..

public function doc_uploaded($field,$types)
{
$types=explode(',',$types);
$upload = $this->CI->lang->line('upload');
/*Defined in lang file as
$lang['form_validation_upload'] = 'The {field} Upload Failed.'; */
if(isset($_FILES[$field]) && !empty($_FILES[$field]['name']))
{
if(!function_exists('file_upload')){ $this->CI->load->helper('MY_file_helper'); }
$status = file_upload(($field),$_FILES[$field], captcha_path(),$types);

if(is_array($status))
{
$this->CI->_error_array[$field] = $status[0];
$this->CI->_error_array[$field] = $status[0];
$this->_error_array[$field]=sprintf( $upload,$this->_translate_fieldname($this->_field_data[$field]['label']));
// echo $field, print_r($this->_error_array);
// print_r($this->CI->_error_array);die();
return FALSE;
}
if($status >0 or strlen($status) > 2 )
{
return TRUE;
}

else
{
$this->_error_array[$field] = $status[0];
return FALSE;
}
}
else
{
return FALSE;
}
}

i am setting the validation rule from controller as follow

$this->form_validation->set_rules('resume', 'Resume', 'required|doc_uploaded[pdf,doc,docx,odt,txt,ppt,pptx]');
$_POST['resume'] ='resume';

now this one working fine except that error massage :

Unable to access an error message corresponding to your field name Resume.(doc_uploaded)

must be an way to fix it please help . iam using 1.4

Comments

  • edited 5:16AM
    Is that error being thrown by your validation method or is that in the form_validation class and if so what line?
  • edited 5:16AM
    this massage not exactly got thrown by by validation method .

    i have tried to set the error massage in this lines

    $this->CI->_error_array[$field] = $status[0];
    $this->CI->_error_array[$field] = $status[0];
    $this->_error_array[$field]=sprintf( $upload,$this->_translate_fieldname($this->_field_data[$field]['label']));

    but those are not working.

    the massage its throwing is from ci validation feature . i got them previously when i have used coll back functions for validations . if the function name was not proper but hear i cant relate them with that senario.
Sign In or Register to comment.