-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
To make it easy to validate, we can use the Laravel validator with Symfony forms:
$form = $factory->create(FormType::class, $user)
->add('name', TextType::class, [
'rules' => 'required',
])
->add('email', EmailType::class, [
'rules' => 'email|unique'
]);This would run the validator post-submit, so you can check $form->isValid() after submitting the form. When failed, the errors on the form are added.
This seems to work already with this commit: 811ca4c
Next step would be to:
- Make the
requiredoption based on the rule, but this would change the default (Symfony default is required = true), to make front-end always in sync with back-end validation - Add HTML5 attributes for rules (eg; min:3 -> minlength attribute etc)
SwenVanZanten
Metadata
Metadata
Assignees
Labels
No labels