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

removeMaskOnSubmit doesn't seem to work on react-hook-form #58

Open
reidark opened this issue Oct 9, 2023 · 1 comment
Open

removeMaskOnSubmit doesn't seem to work on react-hook-form #58

reidark opened this issue Oct 9, 2023 · 1 comment

Comments

@reidark
Copy link

reidark commented Oct 9, 2023

I'm trying to remove masks on form submit. I don't know if there's a better way to do it, but reading the types I found removeMaskOnSubmit, but unfortunately doesn't work too.

<Input
  {...field}  // react-hook-form field props
  {...registerWithMask("phone", ["(999) 999-9999"], {
    removeMaskOnSubmit: true,
  })}
  type="text"
/>

What is the right way to do it?

@reidark
Copy link
Author

reidark commented Oct 19, 2023

For those who are searching something similar, I found out that autoUnmask: true does the trick. This works to validate the raw value with zod schema too.

Don't know if this is the optimal way, but works for now.

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

No branches or pull requests

1 participant