-
-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(getElementInput): Select type number for HTMLSelectElement #259
base: main
Are you sure you want to change the base?
Conversation
Thank you! The bigger question here is if we should support number for |
Sure, that could be an option. But in the current state, it is very easy to assume that One solution is perhaps to create a Another solution would be to create safeguards. For example, if |
Thanks for the detailed answer! I still try to maintain Modular Forms, but I hardly add new features and extend the documentation because I have almost no time besides my studies and Valibot. But I still plan to rewrite Modular Forms one day. If this issue is a blocker for you, I will consider merging it. Otherwise I will consider your feedback when rewriting the library. |
It is not a blocker. Thank you for having a look at this PR. Transforming is a valid solution, although it wouldn't hurt to be a bit more explicit about what you can and cannot do. Feel free to close this PR if you don't feel it brings value. |
Thank you! I think it brings value. I will leave it open for now. I am just careful with my time as other projects like Valibot are a bit more important at the moment. |
d40777c
to
750b759
Compare
Problem
When field type is number and
Field
component is bound to anHTMLSelectElement
, form will always receiveundefined
, asHTMLSelectElement
does not have a propertyvalueAsNumber
.Proposed solution
Add a check if element is
HTMLSelectElement
and inputtype
is number. If true, then returnparseFloat(value)
.What I did
I started by implementing the Solid solution, updated the examples for Solid and then pretty much just copy-pasted the fix for React, Preact and Qwik. I tested them all, they seem to work just fine.