问题
Radio button saves to the database if i select it. But if it loads the radio button on which gender i chose(Male) and i don't touch the radio buttons only other fields to save, it saves the gender as empty?
{this.state.gender == "Male" ? (
<RadioForm
radio_props={radio_props}
initial={0}
onPress={value => {
this.setState({ value });
}}
/>
) : this.state.gender == "Female" ? (
<RadioForm
radio_props={radio_props}
initial={1}
onPress={value => {
this.setState({ value });
}}
/>
) : (
<RadioForm
radio_props={radio_props}
initial={-1}
onPress={value => {
this.setState({ value });
}}
/>
)}
How can the value Male or Female just save to the database also when i am loading data without touching the Radio button options. Is it because of the OnPress?
Thanks for your time!
来源:https://stackoverflow.com/questions/58452358/i-have-a-problem-with-saving-the-radio-button-when-the-radio-button-is-not-selec