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
'initializeForm' take affect only once #495
Comments
You'll have to share some example code. |
In the function 'componentWillMount',call function 'initializeForm' like this: |
To reset back to what you initialized to, you should use |
Thanks erikras very much.If using the prop 'initialValues' to initialize the form,this.props.resetForm() can reset form successfully.I want to initialize the form dynamically,unfortunately,I used function 'initializeForm' to initialize the form,then this.props.resetForm() can not reset form successfully.In addition,I also note that the property 'defaultValue' of form field object is 'undefined' when calling this.props.resetForm(). |
Setting |
I see,initialValues and this.props.initializeForm() will dispatch the same action.However,after 'action=redux-form/INITIALIZE',the fields objects are not the same in the two initial ways.Please see the below('defaultValue' /'initialValue' property is not the same): {active: false
checked: undefined
defaultChecked: false
defaultValue: "SFPB"
dirty: false
error: undefined
initialValue: "SFPB"
invalid: false
name: "appId"
onBlur: (event)
onChange: (event)
onDragStart: (event)
onDrop: (event)
onFocus: ()
onUpdate: (event)
pristine: true
touched: false
valid: true
value: "SFPB"
visited: false
__proto__: Object
} 2、By calling initializeForm() : {active: false
checked: undefined
defaultChecked: false
defaultValue: undefined
dirty: false
error: undefined
initialValue: undefined
invalid: false
name: "appId"
onBlur: (event)
onChange: (event)
onDragStart: (event)
onDrop: (event)
onFocus: ()
onUpdate: (event)
pristine: true
touched: false
valid: true
value: "SFPB"
visited: false
__proto__: Object
} |
Yes, you are correct. I should probably fix that inconsistency. |
…ould come from the state first, props second.
Fix published in |
Thanks erikras. |
I got the same problems in v3.1.0 |
@linlinfly It's been 2+ years since the last time this was an issue. |
@gustavohenke thank you. |
This 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. |
I tried to use the function to reset form values,but it had no affect except the first call.I note that the INITIALIZE action was dispatched.
The text was updated successfully, but these errors were encountered: