[eluser]Unknown[/eluser]
I was trying to make only some of the rule run for form_validation by specifying what to run. For example:
Code:
$this->form_validation->set_rules($config);
if (($this->form_validation->run('username') == FALSE))
{
$this->load->view('templates/header');
$this->load->view('teacher/test_regi');
$this->load->view('templates/footer');
}
where I specified only check for the username field.
When this code is put into practice, all of the rules specified in the $config array is checked. Did I do something wrong?
Many thanks for the help
PS: the $config array is here:
Code:
$config = array(
array(
'field' => 'username',
'label' => 'Username',
'rules' => 'trim|required|xss_clean|min_length[4]|max_length[20]|alpha_dash'
),
array(
'field' => 'password',
'label' => 'Password',
'rules' => 'trim|required|xss_clean|min_length[4]|max_length[20]|alpha_dash|matches[passconf]'
),
array(
'field' => 'passconf',
'label' => 'Password Confirmation',
'rules' => 'trim|required'
),
array(
'field' => 'firstname',
'label' => 'Firstname',
'rules' => 'trim|required'
),
array(
'field' => 'lastname',
'label' => 'Lastname',
'rules' => 'trim|required'
)
)