Sign Up : declare submit button in form builder

master
Julien Rosset 1 year ago
parent b9aed93c9d
commit a9ad001ebc

@ -86,7 +86,7 @@ class UserController extends AbstractController {
} }
return $this->render('user/signUp.html.twig', [ return $this->render('user/signUp.html.twig', [
'registrationForm' => $form, 'signUpForm' => $form->createView(),
]); ]);
} }
/** /**

@ -7,6 +7,7 @@ use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType; use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType; use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\IsTrue; use Symfony\Component\Validator\Constraints\IsTrue;
@ -71,6 +72,9 @@ class SignUpFormType extends AbstractType {
] ]
), ),
], ],
])
->add('submit', SubmitType::class, [
'label' => 'Request account',
]); ]);
} }
} }

@ -9,13 +9,5 @@
<br>You'll receive an email when your account would be accepted <br>You'll receive an email when your account would be accepted
</p> </p>
{{ form_errors(registrationForm) }} {{ form(signUpForm) }}
{{ form_start(registrationForm) }}
{{ form_row(registrationForm.email) }}
{{ form_row(registrationForm.newPassword) }}
{{ form_row(registrationForm.agreeTerms) }}
<button type="submit" class="btn btn-primary">Request account</button>
{{ form_end(registrationForm) }}
{% endblock %} {% endblock %}

Loading…
Cancel
Save