I'm trying to disable the frontend HTML5 validation for a filed in a form built in Symfony.
In Twig, i use this code:
{{ form_widget(form.email, {'attr': {'class': 'form-control input-lg','novalidate': 'novalidate}}) }}
but the field is still considered as required. What am I doing wrong?
You can set that in your form type to disable the field validation.
->add('test', null, array(
'required' => false
))
If you want to disable it for the whole field you can try something like this:
{{ form_start(form, { attr: {novalidate: 'novalidate'} }) }}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With