Disabled Fields not getting initialValues; formatting does not work
See original GitHub issueHi, as I was using redux-form to create a connected component for my form. I struggled with the following 2 issues.
- Disabled Fields not getting initialValues In my form, I have
<Field
name="abc"
label="ABC"
component={FormField}
input={{
disabled: true,
}}
required
/>
FormField
takes input and add all the props to <input {...input}>
However, no initial value is shown when the input field is disabled. When I took out the input disabled prop, the correct value shows up. From network response, I see that the value is there. It is just not getting displayed when the field is disabled for some reason.
- format I passed in both functions and anonymous arrow functions to the format prop but nothing worked, even when I had a dummy function that return a hard coded default value.
const formatField = (value, name) => {
switch (name) {
case '1':
return 'something'
case default:
return 'default'
}
}
or a simpler function
format={(v) => v.toLocaleString('en')}
Thank you!
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:7
Top Results From Across the Web
26129 (bound forms do not display disabled field initial values)
The subject pretty much says it all. If you create a form with an initial value for a disabled field, it displays fine...
Read more >javascript - Ant Design component initialValue is not working ...
I have a modal which has a form inside of it. This modal is controlled by its parent. Its parent can open the...
Read more >Final Form Docs – `FieldProps`
If true , the format function will only be called when the field is blurred. If false , format will be called on...
Read more >lightning-record-edit-form - Salesforce Developers
The InformalName field is not supported for editing. For a list of supported objects, see the User Interface API Developer Guide. If you...
Read more >Handling Forms - VeeValidate
This is because in most cases you don't need the model values until you ... sure the form is not submitted unless all...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@hannahjin & @catsky had the same issue ended up using
inside
renderInput
and passed disabled as a prop inField
componentThis thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.