Here is my typical form
$errors = array();
if ($this->request->post('submit')) {
$post = Validation::factory($this->request->post())
->rule('email', 'not_empty')
->rule('email', 'email')
->rule('password', 'not_empty');
if ($post->check()) {
}
$errors = $post->errors(true);
}
$this->template->content = View::factory('auth/register')
->set('errors', $errors);
As you can see - I am checking if there is a submit element, which means that we actually posted the form, and not just requested for the first show.
If we remove this condition, we will have validation errors for requesting the first page. Errors in blank email and password form. This is actually not true.
So how do you solve this problem?
source
share