dohomi / react-hook-form-mui

Material-UI form components ready to use with react-hook-form
https://react-hook-form-material-ui.vercel.app
MIT License
560 stars 111 forks source link

How to use setAsValue? #306

Closed tjx666 closed 2 months ago

tjx666 commented 2 months ago

Duplicates

Latest version

Current behavior 😯

No response

Expected behavior 🤔

No response

Steps to reproduce 🕹

I want to use setAsValue to trim the user input, but can't find a way to do this.

ref: https://github.com/orgs/react-hook-form/discussions/8903#discussioncomment-10241028

sadik-malik commented 2 months ago

@tjx666 setValueAs is not supported by react-hook-form-mui components since these components rely primarily on useController. You can achieve the same behavior as setValueAs by using the output function in the transform prop.

tjx666 commented 2 months ago

thanks reply