You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
since setDefaultValues calls setState inside Formous, the form component that is wrapped by Formous can still rendered once without default values
ie in the form's componentWillMount
componentWillMount() {
this.props.setDefaultValues({
someField: 'hello'
});
},
render() {
this.props.fields.someField.value; // this will still be an empty string: ""
// ...
}
it would be nice if the field options allowed an initial value or do you have another idea how render could be prevented until i am able to set the default value?
The text was updated successfully, but these errors were encountered:
Well, upon initial rendering, you're right, the field values would be empty. But a second render is performed when the values are populated, and then the fields are filled. If you put together a test project, you'll see that it works ok and all the fields are properly filled with defaults.
If you find that's not the case or there's some other issue, let me know!
i guess the problem is that it still causes a render with an empty string value which requires all components that take a value to accept and still render when an empty string value is given.
this is a problem in cases such as a dropdown select where a component might expect a valid value (a value that is an option)
Dropdowns aren't supported just yet. Getting there!
If setDefaultValues is not working the way you expect, could you put together a reproduction of the problem you're experiencing? That way I can run it myself and take a look at what's going on.
since
setDefaultValues
calls setState inside Formous, the form component that is wrapped by Formous can still rendered once without default valuesie in the form's componentWillMount
it would be nice if the field options allowed an initial
value
or do you have another idea how render could be prevented until i am able to set the default value?The text was updated successfully, but these errors were encountered: