Welcome Guest, Not a member yet? Register   Sign In
Validation problem - Config | Callback | Controller
#18

[eluser]Multisnet[/eluser]
Michael,

I think that what I'm doing is correct, please check this from User Guide:

Creating Sets of Rules

In order to organize your rules into "sets" requires that you place them into "sub arrays". Consider the following example, showing two sets of rules. We've arbitrarily called these two rules "signup" and "email". You can name your rules anything you want:

Code:
$config = array(
                 'signup' => array(
                                    array(
                                            'field' => 'username',
                                            'label' => 'Username',
                                            'rules' => 'required'
                                         ),
                                    array(
                                            'field' => 'password',
                                            'label' => 'Password',
                                            'rules' => 'required'
                                         ),
                                    array(
                                            'field' => 'passconf',
                                            'label' => 'PasswordConfirmation',
                                            'rules' => 'required'
                                         ),
                                    array(
                                            'field' => 'email',
                                            'label' => 'Email',
                                            'rules' => 'required'
                                         )
                                    ),
                 'email' => array(
                                    array(
                                            'field' => 'emailaddress',
                                            'label' => 'EmailAddress',
                                            'rules' => 'required|valid_email'
                                         ),
                                    array(
                                            'field' => 'name',
                                            'label' => 'Name',
                                            'rules' => 'required|alpha'
                                         ),
                                    array(
                                            'field' => 'title',
                                            'label' => 'Title',
                                            'rules' => 'required'
                                         ),
                                    array(
                                            'field' => 'message',
                                            'label' => 'MessageBody',
                                            'rules' => 'required'
                                         )
                                    )                          
               );

Calling a Specific Rule Group

In order to call a specific group you will pass its name to the run() function. For example, to call the signup rule you will do this:

Code:
if ($this->form_validation->run('signup') == FALSE)
{
   $this->load->view('myform');
}
else
{
   $this->load->view('formsuccess');
}

All is working before I tried to extend the base CI class... If I remove my class extension (e.g. change the filename MO_Form_validation.php to XXMO_Form_validation.php) all works good again...


Messages In This Thread
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 08:42 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 08:54 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 08:55 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 08:57 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 09:01 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 09:11 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 09:45 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 09:54 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 10:04 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 10:05 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 10:21 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 10:22 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 10:24 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 11:58 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 12:56 PM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 01:23 PM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 01:29 PM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 03:02 PM
Validation problem - Config | Callback | Controller - by El Forum - 06-25-2009, 06:16 AM



Theme © iAndrew 2016 - Forum software by © MyBB