Welcome Guest, Not a member yet? Register   Sign In
set error status for a validation library for a given field true
#1

[eluser]Gewa[/eluser]
Hi,
I didn't found a such thing.
I want to set an error status for a given form field to true before the validation is run in case the file is not uploaded and set the error message for that given case . How to do it?

something like
Code:
$this->validation->error('field_name',TRUE);
               $this->validation->error_message('field_name','Upload was unsuccessfull Check the file type ');


so that during validation , it will understand there is error for that field and show the error in given field with show_error('field_name);
#2

[eluser]Philipp GĂ©rard[/eluser]
Why would you set the result of a valdidation to 'true' (i.e. error found) before validating? Makes no sense to me ;-)

Ah, you edit, I edit:

http://ellislab.com/codeigniter/user-gui...#callbacks
#3

[eluser]Gewa[/eluser]
I am not sure the callbacks will help...Sad

the one way I think is to make a callback function which always returns false ....
#4

[eluser]Gewa[/eluser]
solution was

Code:
if (!$this->upload->do_upload($key))
        {
        $this->form_validation->set_rules($key, $value['name'], 'callback__upload_false');
$this->form_validation->set_message('_upload_false', $this->upload->display_errors());
        
        }
        else




Theme © iAndrew 2016 - Forum software by © MyBB