final-form / final-form/react-final-form
Why form.change can't change value if there is not a corresponding field ?
- Dominant language
- JavaScript
- Stars
- 7.4k
- Forks
- 497
- PR merge metrics
- No merged PRs in 30d
Description
Hello !
i tried to change my form values using form.change, but it seems to work only if there is a corresponding field. Is there any reason to not allow to change freely values and add new keys ?
My use case : i have a "country" autocomplete text fields.
When a "country" is selected, autocomplete give me a complex object about the country like this
```js
{
name: "France",
code: "FR",
...otherProperties
}
```
and i would like to add this to my submitted values. Do not care so much about what there is in my autocomplete input, i cared much about the object, return by the autocomplete suggestion list.
For now i am playing with "format" prop and return an object as a value on onChange, but it feels somehow hackish to me ?
```
suggestion.label}
className="is-large"
autocompleteCallback={getCountriesByName}
/>
```
Contributor guide
Research direction
Start by tracing the form.change entry point and the Field value flow, including the format and onChange workaround shown in the issue. Determine the intended behavior for values without a corresponding field; done means the country object use case has a clear supported behavior and regression coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100