uniforms: SelectField value not being set in submission document
I use a SelectField like this:
<AutoForm
schema={Collection1.schema}
onSubmit={doc => console.log(doc)}
>
<SelectField name="field1" onChange={(value) => { this.setState({ stateVar: value }) }} value={this.state.stateVar} />
this.state was initialized in the constructor:
constructor(props) {
super(props);
this.state = {
stateVar: "N",
};
}
If field1 is not set as optional in the schema, then validation fails with the “required” error message.
if optional: true is set for field1, the console.log shows no field1 in the submission document.
How can this problem be fixed?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 16 (15 by maintainers)
I’ve just made a new minimal app to reproduce the error:
Run the app and click on Submit. It will say Item ID is required even though “label 1” is clearly selected.
Please reopen this issue, as it was closed prematurely.