Disabling HTML5 Form Validation Using the Laravel Form Builder

  • February 18, 2015

Welcome to the incredibly popular Easy Laravel 5 companion blog. To celebrate the new edition's release (updated for Laravel 5.5!) use the discount code easteregg to receive 20% off the book or book/video package! » Buy the book

HTML5 form validation is great, offering an easy way to perform basic client-side form validation without the need to integrate custom JavaScript. For instance HTML5 will by default prevent a form from being submitted if a text field is left blank, and present a little popup like that found in the below screenshot:

HTML5 form validation

However, there are certainly occasions when you'll want to disable this feature, particularly when testing your server-side form validation. To do so using Laravel's Form Builder you'll pass the novalidate option like so:

{!! Form::open(array('route' => 'lists.store', 
    'class' => 'form', 'novalidate' => 'novalidate')) !!}

If you're hand-coding your form, you'll pass the novalidate option like this:

<form action='/contact' method='post' novalidate>