Validation with SSR (HTMX) #2271
Replies: 4 comments 1 reply
-
Hi, the Your code should look like this: Initial code:
After submission:
|
Beta Was this translation helpful? Give feedback.
-
Please, explain what is going on after submission. If you swap all form it won't work because the instance is not initialised on it. You should add the same logic as in the Basic Example of Validation component after submission. Could you also provide me with a sample code/snippet? |
Beta Was this translation helpful? Give feedback.
-
I think I get it, I'm swapping the entire element.Here is a repo with the code I'm testing https://github.com/yazalulloa/tw-elements-validation-ssr So to understand, first the elements needs to initialized, after initialization the attributes data-te-validation-state and data-te-validated needs to be added to the elements? |
Beta Was this translation helpful? Give feedback.
-
After testing I figured it out, the data-te-validation-state needs to be set before the data-te-validated to trigger the validation animation, I use hyperscript to do it, thanks |
Beta Was this translation helpful? Give feedback.
-
Hi, I'm building a minimal web application with HTMX, on form submission in case of an error I want to use the validation components to display errors
The initial code is this:
After submission I swap the form with this:
script="init call initComponents()"
This calls initTE({Validation, Input})But the error is not showing, is there a way to use the validation component this way?
Beta Was this translation helpful? Give feedback.
All reactions