Welcome Guest, Not a member yet? Register   Sign In
Form Validation and the bahaviour when the field id NOT required
#2

[eluser]Colin Williams[/eluser]
So, if password_new is supplied, then password_new2 IS required. So, in code, this looks like:

Code:
$passnew2rules = 'trim|matches[password_new]|xss_clean';
if ($this->input->post('password_new'))
{
  $passnew2rules .= '|required';
}
$this->form_validation->set_rules('password_new2', 'New Password Confirm', $passnew2rules);

Quote:Let me know what you think, if this behaviour is logical and I have just a different view. I think it should match other rules although it’s empty and not required (at least some of them, like “matches”).

I think there definitely is a case where that should be considered.


Messages In This Thread
Form Validation and the bahaviour when the field id NOT required - by El Forum - 03-07-2009, 05:04 PM



Theme © iAndrew 2016 - Forum software by © MyBB