Programmatically Changing Values (like setValue or setFieldValue) #486
-
I'm interested in the most straightforward/streamlined methods to programmatically change a field's value using Conform. Some examples of when you'd want to do this are when a user chooses an option from a drop-down, and then your application will pre-fill related fields, or populate hidden field values. Similar functionality can be seen in the setValue function in react-hook-form, and setFieldValue in Formik. Here's my best guess at how this would be done in Conform: https://stackblitz.com/edit/remix-run-remix-indwbm?file=app%2Froutes%2F_index.tsx In this example, you choose a restaurant and have the order type prepopulated for you based on what the restaurant prefers. Is this performant/preferred? One issue I'm seeing is that if a form changes many fields programmatically, you wind up with a lot of useInputControl hooks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
The |
Beta Was this translation helpful? Give feedback.
All form intents could be called directly, e.g.