I made a simple registration form, but if the validation fails, I don't want the user to have to retype all the values. In laravel, for example, I can get the previously submitted email with :
<input type="email" name="email" value="">
What is the best way to do this in Symfony?
I am validating like this in Symfony:
$errors = $this->get('validator')->validate($user);
if (count($errors) > 0) {
foreach ($errors as $error) {
$request->getSession()->getFlashBag()->add('error', $error->getMessage());
}
return $this->redirect('/signup');
}
via billyhafiz