modularforms controlled/transform inputs not working
Hello, I am encountering multiple issues using modular forms with solid js
many functionalities like controlled inputs and transforms seems like not work reliable, let me share with you some recordings
here is a demo https://stackblitz.com/edit/modular-forms-solid-n51ey1?file=src%2Fapp.tsx
This is regarding to transform on inputs
but I've not been able to get to work controlled inputs either following the instructions here https://modularforms.dev/solid/guides/controlled-fields
demo: https://stackblitz.com/edit/modular-forms-solid-mmn1cp?file=src%2Fapp.tsx
I am attaching also video recordings
StackBlitz
Solid Playground | Modular Forms (forked) - StackBlitz
The playground contains different forms to test the functionality of the library during development.
1 Reply
In the modular forms guide:
<input type="number" ....
also for the
<Field type="number" ....
so that the value passed to the input is actually a number. Then it'll work as expected.
https://stackblitz.com/edit/modular-forms-solid-sjk4uj?file=src%2Fapp.tsx
Regarding transforms:
transform in input ends usually in a weird user experience. I'd rather do that on blur expect for stuff like toLowerCase for email adresses etc.
For numbers and more complex stuff I usually use the field validation library (zod, valibot) to transform the values on validation.