Open eyemono-moe opened 11 months ago
This is a general problem with Modular Forms for SolidJS that I am trying to fix in January. The problem is that the library only initializes a field when you call setValue
or add the props
of <Field />
to an <input />
or <select />
element. Therefore, when you call getValues
the library is not aware of these values.
As a workaround for now you can call setValue
for each field in onMount
or createEffect
.
minimal reproduction:
The documentation suggests using
shouldActive: false
withgetValues()
to retrieve values of inactive fields. However, when a<Field>
is initially hidden and never becomes active, settingshouldActive
tofalse
does not allow retrieval of values for inactive fields.In the above demo, only the
email
field is retrieved after the page loads, even thoughshouldActive
is set tofalse
. Clicking the "show password" checkbox makes the password field visible even after becoming inactive.Moreover, similar to the issue of not being able to retrieve values for inactive fields with getValues, the reset does not work for fields that have never been active. In the demo, pressing the "Reset" button resets "reset email" and "reset password," but if the password field has never been active, pressing "Reset" does not change it to "reset password."
Is this the intended behavior?