I'm creating a form and now attempting to do some input validation, and I'm struggling to grab the checked value from my radio component.
In one file I have:
<FormControl component="fieldset" name="method-of-payment">
<RadioGroup onChange={this.handleChange} >
<FormControlLabel value="credit" control={<Radio />} label="Credit Card"/>
<FormControlLabel value="check" control={<Radio />} label="Check"/>
<FormControlLabel value="purchase-order" control={<Radio />} label="Purchase Order"/>
</RadioGroup>
</FormControl>
And I'm trying to grab the value doing this in another file (it's worked for everything else):
this.setState({
method-of-payment: document.getElementsByName('method-of-payment')[0].value
})
But I'm having no luck getting the correct value.
I appreciate any help.
Edit: here's a link to the documentation I followed: https://material-ui.com/components/radio-buttons/