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
{{ message }}
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.
I need a way to turn empty string into '0' or at least 0 for checkboxes.
Currently I am mapping those values on submit, however it requires to keep track of which fields are checkboxes (working with big forms). To avoid keeping track of field types, I thought to look for checked property as a way to differentiate checkboxes from other fields, but the only thing available is formState.fields[name].props.checked which are initial props and do not update.
Ideally, this would be dealt with on a field instance and not submit. Also looked into creating a separate CheckboxField component, but it seems that '' is hardcoded in the Informative internals, so dealing with it there is too late.
How about an uncheckedValue prop?
What would be the best way to do this?
Thanks
The text was updated successfully, but these errors were encountered:
I need a way to turn empty string into
'0'
or at least0
for checkboxes.Currently I am mapping those values on submit, however it requires to keep track of which fields are checkboxes (working with big forms). To avoid keeping track of field types, I thought to look for
checked
property as a way to differentiate checkboxes from other fields, but the only thing available isformState.fields[name].props.checked
which are initial props and do not update.Ideally, this would be dealt with on a field instance and not submit. Also looked into creating a separate CheckboxField component, but it seems that
''
is hardcoded in the Informative internals, so dealing with it there is too late.How about an
uncheckedValue
prop?What would be the best way to do this?
Thanks
The text was updated successfully, but these errors were encountered: