CodeIgniter Forums
Trying to use form_validation rule group; not happening - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Trying to use form_validation rule group; not happening (/showthread.php?tid=14006)



Trying to use form_validation rule group; not happening - El Forum - 12-15-2008

[eluser]Daniel H[/eluser]
Hi all,

I'm trying to validate a comment form against a rule group specified in a config file named form_validation.php. It contains this:

Code:
<?php
$config = array(
                 'comment_form' => array(
                                    array(
                                            'field' => 'content',
                                            'label' => 'Comment',
                                            'rules' => 'trim|xss_clean|strip_tags|required'
                                         )
                                    )                    
               );
?>

Then I'm trying to load the rule using:

Code:
// Run the comment form validation
        if ($this->form_validation->run('comment_form'))
        {                    
...

However, it appears that the form validation is not performed at all (and no error occur). Am I missing the point here?

Dan.