Welcome Guest, Not a member yet? Register   Sign In
Form Validation (Twice)
#5

[eluser]macigniter[/eluser]
I am running the validation twice in one of my controllers because I want to validate one rule before all others. This way I don't get all of the error message of the second validation if the first one didn't even pass.

I am using this approach:

Code:
// set first validation rule
$this->form_validation->set_rules(...);

// only if first rule passed, check for other rules            
if ($this->form_validation->run() == TRUE)
{
    $this->form_validation->set_rules(...);
    $this->form_validation->set_rules(...);
}

// if first rule didn't pass the form only displays an error for the first rule
if ($this->form_validation->run() == FALSE)
{
    // then re-populate form
}

Is that something you anticipated?


Messages In This Thread
Form Validation (Twice) - by El Forum - 02-06-2009, 04:51 PM
Form Validation (Twice) - by El Forum - 02-06-2009, 05:54 PM
Form Validation (Twice) - by El Forum - 02-06-2009, 05:57 PM
Form Validation (Twice) - by El Forum - 02-06-2009, 06:06 PM
Form Validation (Twice) - by El Forum - 02-06-2009, 06:15 PM
Form Validation (Twice) - by El Forum - 02-06-2009, 06:20 PM
Form Validation (Twice) - by El Forum - 02-06-2009, 07:33 PM
Form Validation (Twice) - by El Forum - 02-07-2009, 02:30 PM
Form Validation (Twice) - by El Forum - 02-12-2009, 12:08 AM
Form Validation (Twice) - by El Forum - 02-13-2009, 08:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB