You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use svelte material ui components to display text fields. I have provided initialValues object to createForm and it contains blank strings. My use case is to have a single form with ability to dynamically add fields when I click on a button. I use felte and @felte/validator-yup to validate. Here are my observations:
The form is not validated when each field is blurred
Validation kickstarts when I try to add more input elements to form dynamically
When the with required attribute is blurred an error is displayed.
The version of packages used:
"felte": "^1.2.6",
"@felte/reporter-dom": "^1.1.5",
"@felte/validator-yup": "^1.0.11",
I could narrow down the issue to only form validation happening when new fields are added. The other issues were due to the value not bound to the input field. Eg: input$name="abc" should work in the above example from codesandbox. Is there a way hence to stop the validation from kickstarting when new elements are added to the form? And restrict it to only when the blurring from the respective field to be validated happens?
Hello! I'm sorry for the delay. Trying to catch up with everything lately.
So I think the issue boils down (mainly) to the fact that smuidoes not forward the name prop to the inputs. Which means that, for all intents and purposes, all inputs are the same name='' to Felte. The reporter you are using "reports" based on the name but not a single input actually has a name.
This is the kind of components where I would recommend using createField to create a wrapper on top of these components.
Describe the bug
I use svelte material ui components to display text fields. I have provided initialValues object to
createForm
and it contains blank strings. My use case is to have a single form with ability to dynamically add fields when I click on a button. I use felte and @felte/validator-yup to validate. Here are my observations:The version of packages used:
"felte": "^1.2.6",
"@felte/reporter-dom": "^1.1.5",
"@felte/validator-yup": "^1.0.11",
Which package/s are you using?
felte (Svelte), @felte/validator-yup, @felte/reporter-dom
Environment
To reproduce
Small reproduction example
https://codesandbox.io/p/sandbox/flamboyant-brattain-mbepnt
Screenshots
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: