public static function validate_register_form() {
$val = Validation::forge('registro');
$val->add_field('email', 'E-mail', 'required|valid_email|max_length[100]');
$val->add_field('name', 'Nombre', 'required|max_length[255]');
$val->add_field('surname', 'Apellidos', 'required|max_length[255]');
$val->add_field('company', 'Empresa', 'required|max_length[255]');
$val->add_field('tel', 'Teléfono', 'required|max_length[50]');
$val->add_field('password', 'Contraseña', 'required|max_length[100]');
return $val;
}
public function action_register() {
if (Input::method() == 'POST') {
$val = Model_User::validate_register_form();
// Error en el form
if ($val->run()) {
// Continue coding here...
//Session::set_flash('success', 'FORM OK');
//Response::redirect('login');
} else {
//Debug::dump($val);
//die();
Session::set_flash('error_registro', $val->error());
Response::redirect('login');
}
}
}
<?php if (Session::get_flash('error_registro')): ?>
<?php echo implode('<br>', e((array) Session::get_flash('error_registro'))); ?>
<?php endif; ?>
It looks like you're new here. If you want to get involved, click one of these buttons!