- Add HTMX attributes to the form.
<form
hx-post="/foo"
hx-ext="bs-validation"
class="row g-3 needs-validation"
novalidate
>
</form>
See example: https://getbootstrap.com/docs/5.1/forms/validation/#custom-styles
- on first load the extension adds
hx-trigger="bs-validation"
to the form and asubmit
event listener to deal with the custom styles (in order for bootstrap custom styles appear,novalidate
bypasses browsers native form validation)
Some Alpine.js magic if that is an option.