Validation won't work |
[eluser]IamPrototype[/eluser]
I load the library validation in my controller like this. Code: function Overview() This is my submit_comment function which is placed in the Overview Controller. Code: function submit_comment() My form looks like this: Code: <?=$this->validation->error_string?> It just returns false whenever I try. I could use some help... I've tried different stuff, but it didn't work well. Also I would to have the error message displayed on the form page, but it won't.. (I mean so the guest can see what he/she is doing wrong, too many chars etc.) ** ...Yes, I've seen that I use the XSS cleaner twice, my bad.
[eluser]xwero[/eluser]
You are working with the old validation library, is there a reason not to use the new library? I believe Micheal Wales mentioned this before but he didn't write why it returned false all the time.
[eluser]Ivan A. Zenteno[/eluser]
maybe you need $this->validation->set_fields($array_fields)
[eluser]IamPrototype[/eluser]
[quote author="Ivan A. Zenteno" date="1232439139"]maybe you need $this->validation->set_fields($array_fields)[/quote] Instead of rules, or what?
[eluser]xwero[/eluser]
the old validation library : Validation.php, the new validation library : Form_validation.php. Old adding of rules Code: $rules['author'] = 'required|min_length[5]|max_length[12]|xss_clean|trim|addslashes'; Code: $this->validation->set_rules('author','Author','required|min_length[5]|max_length[12]|xss_clean|trim|addslashes');
[eluser]IamPrototype[/eluser]
I tried the new way of adding rules, and it won't work, check my demo on http://habbofreak.kliboo.net/ (click "Comments" and try adding some comments). It doesn't turn into false. I can click "Submit Comment!" without any input value and it submits the comment without data. # submit_comment function placed in my controller Code: function submit_comment() # html form placed in my view Code: <?=$this->validation->error_string?>
[eluser]xwero[/eluser]
the new validation way also means loading the new validation library. Code: $this->load->library('form_validation');
[eluser]xwero[/eluser]
You could try to reduce the rules to check of they are the problem. |
Welcome Guest, Not a member yet? Register Sign In |