Closed melijimenez11 closed 11 months ago
When you don't want the Select component to update invalid
automatically, you can set updateInvalid={false}
. That will let you update the invalid
prop dynamically.
I added a demo on the website for this feature.
Describe the bug I'm trying to set a Select component to invalid, dynamically, when there are form errors in the page. But the documentation isn't clear at all about how to do this. If I hardcode the attribute
invalid
into the component, or I setinvalid=true
it works. The Select field looks invalid as expected then. But it doesn't work dynamically by settinginvalid={validationFunction}
orinvalid={booleanIsValidVar}
during form validationTo Reproduce Steps to reproduce the behavior: See the following REPL code and copy it in your project https://svelte.dev/repl/7db777a3d20649a497d66d160cf3bb2f?version=4.2.1
Expected behavior When invalid is set to true during runtime (form validation), the field should be styled to be invalid.