Hello im trying to fill the Checkbox value with my state but it dont accept it.
The Checkbox Code:
<Form.Item label="Aktiv" > <Checkbox value={this.state.selectedRecord.active} /> </Form.Item> The AntD documentation here says to the question "Why not work in Form.Item?":
"Form.Item default bind value to value property, but Checkbox value property is checked. You can use valuePropName to change bind property."
So, you could try:
<Form.Item label="Aktiv" valuePropName="checked"> <Checkbox value={this.state.selectedRecord.active} /> </Form.Item> But it still doesn't work for me for some reason, so I used something like this:
<Form.Item label="Aktiv" name="aktiv"> <Checkbox /> </Form.Item> and this to set it checked or unchecked:
form.setFieldValue('aktiv', {this.state.selectedRecord.active});