[Feature Request]: Transform values on submit
Open
Nobody has claimed this yet.
type: enhancement
v1
- Dominant language
- TypeScript
- Stars
- 6.7k
- Forks
- 682
- Avg merge
- 5d 18h
- Merged PRs (30d)
- 7
Description
This feature request comes from https://github.com/houseform/houseform/issues/60, the older form library I maintained
Description
Ideally, I'd like to have a number, displayed as a string (say, a locale with 1,000,000) and then transform this number back during the field submission.
<Field
name="number"
initialValue={'0'}
// This is the magic
transformOnSubmit={v => parseFloat(v)}
onChangeValidate={z.coerce.number().min(1, 'Must be at least 1')}
/>
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Field API shown in the example and trace how field values are collected during submission. Review the existing submission and validation entry points, then establish how a transform callback should affect submitted values while leaving displayed values intact; done means the documented example behavior is covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100