3 ms·
two possible approaches: 1. Do the validation server side and replace the input (or a label next to the input, see https://htmx.org/examples/inline-validation/
by recursivedoubts 1y ago
two possible approaches:
1. Do the validation server side and replace the input (or a label next to the input, see https://htmx.org/examples/inline-validation/ https://htmx.org/examples/inline-validation/)
2. Use the HTML 5 Client Side form validation API, which htmx respects:
https://developer.mozilla.org/en-US/docs/Learn_web_development/Extensions/Forms/Form_validation https://developer.mozilla.org/en-US/docs/Learn_web_developme...
- hirvi74 1y agoWell, I never expected to get a reply from the man himself. Thank you for taking the time to respond. So, I did end up going with #1 with a slight variation. You also commented on another comment of mine stating: > if you are using the htmx javascript API extensively rather than the attributes, you are not using htmx as it was intended There seems to be some confusion, and I apologize. I extensively used attributes. That wasn't the part of the API I was referring to. Rather, I should have specified that I was heavily relying on a lot of the htmx.on() and html.trigger() methods. My usage of htmx.trigger() was predominately due to something being triggered on page load, but also, it needed to be triggered again if a certain condition was met -- to refetch the html with the new data -- if that makes sense. I should also preface that I was working on this project about two years ago. It looks like a lot has changed with HTMX since then!