Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: Transform values on submit #418

Open
crutchcorn opened this issue Aug 30, 2023 · 4 comments
Open

[Feature Request]: Transform values on submit #418

crutchcorn opened this issue Aug 30, 2023 · 4 comments

Comments

@crutchcorn
Copy link
Member

This feature request comes from houseform/houseform#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')}
/>
@CheRayLiu
Copy link
Contributor

Hey @crutchcorn, mind assigning me this for me to work on? 🙏

@crutchcorn
Copy link
Member Author

Done! Thanks for taking this on @CheRayLiu.

Something worth considering is how we will/should handle TypeScript typings for transformations.

@CheRayLiu CheRayLiu removed their assignment Dec 4, 2023
@CheRayLiu
Copy link
Contributor

Unassigned myself for now as I don't see myself working on it any time soon

@crutchcorn
Copy link
Member Author

No worries @CheRayLiu! Thanks for being willing in the first place :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants