react-query-questions
solid-query-questions
table-questions
virtual-questions
router-questions
react-charts-questions
ranger-questions
vue-query-questions
svelte-query-questions
bling-questions
form-questions
angular-query-questions
start-questions
db-questions
start-showcase
router-showcase
📣-announcements
Type safety with prebound Form components
State and Inertia.js integration
Partial reset of a modified form
RHF's onTouched mode
onTouched
mode? There doesn't appear to be an equivalent option for validators
.
https://www.react-hook-form.com/api/useform/#mode...`field.state.meta.isValid` not updated when validating on the server
field.state.meta.isValid
is true in Next.js after server validation, unless I also apply the same validation on the client. Shouldn't that state be merged by mergeForm
? Would be a lot easier DX if I could just rely on field.state.meta.isValid
and field.state.meta.errors
instead of having to merge those manually.Why can field validation overwrite form validation errors?
Something worth mentioning is that if you have a form validation function that returns an error, that error may be overwritten by the field-specific validation.I was wondering what the rationale is for this behavior/limitation?
errorMap
already stores errors from different points in the form lifecycle (onBlur
/onChange
etc), why not also store form
/field
errors separately?...Form persistence
Sharing form type to custom hooks for cleaner code
Default values with zod validation
dynamic defaultValues
draft.content
, draft.title
and published.content
, published.title
.
On the "Draft" tab there are "Publish" and "Save draft" buttons.
- Publish button is submitting the data as "published" entry, and then deletes the "draft" entry, and resets the draft.xxx
fields, and resets the default values for the published.xxx
fileds.
- Save draft button is saving the values as "draft" entry (idk if the form should be reset in this case?...)...Async form default based on another field
form is populating with errors but errors.status logging as 'clean'
custom reusable form.Field component, trying to use Form Composition
Is it possible to persist form state?
Type inference issue with MomentJS
Get type inference without using defaultValues
defaultValues
in my form and resetting the form when the deliveryNote
prop changes because I want my form to be synchronized with my data sources, both the deliveryNote
and nextAvailableDeliveryNoteIdData
are updated in realtime.form with dependent fields (more complicated than just linking)
cost
field, i'm tracking the raw value, for the splits field, i'm tracking only the percentage value. when it transitions to 'amount' mode, i just compute the value from the percentage of the value in 'amount', and show that. similarly onchange, i just transform the raw value into the proper percentage
in the basic cases this is easy. percent mode is no problem, those don't even really care what cost
is, where just tracking essentially a proportion. also, when cost
is static, this is also easy, the transform cycle above ^, is straightforward enough
this gets tricky when you're in amount
mode AND change the cost
value. this gives me two possible scenarios:...
generic Input element
typing `withForm`
withForm
?
```ts
import { useAppForm, withForm } from "~/hooks/form";
const PersonalInfoSection = withForm({...