How to apply <novalidate> to Action Modals

Sometimes I prefer to use the backend validations rather than the browser validations. Any idea idea how to insert novalidate to the <form> from Action modals?
5 Replies
LeandroFerreira
LeandroFerreira5mo ago
what browser validations?
Dennis Koch
Dennis Koch5mo ago
The default validation you get when you add required etc attributes to your inputs.
LeandroFerreira
LeandroFerreira5mo ago
yes, but we have more than required I guess instead of ->required() we can use ->rules(['required'])... this is why I'm asking
awcodes
awcodes5mo ago
Only way to do this currently using novalidate on the form would be with JS
vahnmarty
vahnmartyOP5mo ago
yes, I tried the js way:
// Select all forms on the page
const forms = document.querySelectorAll('form');

// Iterate over each form and add the novalidate attribute
forms.forEach(form => {
form.setAttribute('novalidate', true);
});
// Select all forms on the page
const forms = document.querySelectorAll('form');

// Iterate over each form and add the novalidate attribute
forms.forEach(form => {
form.setAttribute('novalidate', true);
});
but everytime i click the action button, the attributes gone.
Want results from more Discord servers?
Add your server