My purpose like this: https://stackoverflow.com/questions/21666082/phalcon-validation-doesnt-work-not-in-model
I want to validate when form login submit. When submit, i get message error from browser: "The connection was reset".
use Models\Glang\User;
use Phalcon\Validation\Validator\Email;
class LoginController extends \Phalcon\Mvc\Controller{
public function indexAction($username = null, $password = null){
$validation = new \Phalcon\Validation();
$validation->add('email', new Email(array(
'message' => 'The e-mail is not valid'
)));
$messages = $validation->validate($_POST);
if (count($messages)) {
foreach ($messages as $message) {
echo $message, '<br>';
}
exit;
}
}
}