TanStack / TanStack/form

[Feature Request]: Transform values on submit

Open
#418 22 comments 56 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.