colinaut / alpinejs-plugin-simple-validate

Simple Alpine form validation plugin
97 stars 4 forks source link

html5 required fields no longer working #12

Closed phoozle closed 1 year ago

phoozle commented 1 year ago

Problem: We have a mix of required attributes and x-validate.url on our forms. Since version 1.7.14 onwards our required fields are no longer getting picked up when the user hits the submit button.

I assume this is because novalidate is now being added to the

. Is there a way I can disable this?

Cheers

colinaut commented 1 year ago

The plugin grabs all fields marked with the required attribute too. For submit validation, it assumes that you'd be using either @submit="$validate.submit" or your own script for submit validation rather than using the built in browser validation. In case for some reason you need browser validation as well, I added a modifier for opt-out of novalidation in 1.7.18. Just write x-validate.use-browser on the form element.