why my app can’t handle the radio button selected value of the form?

I am new to ReactJS, sorry if this sounds off. I am trying to create a user with a form that contains a multi radio buttons field. when a fill up the form and then submit the document is stored in database but the type field is empty. And thats where I am stuck.

class SignupForm extends Component {
    constructor(props) {
        this.state = {
            name: '',
            email: '',
            prenom: '',
            password: '',
        this.handleInputChange = this.handleInputChange.bind(this);
        this.handleSubmit = this.handleSubmit.bind(this);


    handleInputChange(event) {
        const target = event.target;
        const inputName = target.name;        
        const inputValue = target.value;

            [inputName] : inputValue

    handleSubmit(event) {

        const signUpRequest = Object.assign({}, this.state);

        .then(response => {
            Alert.success("Votre inscrption est réussi. Veuillez s'authentifier pour continuer!");
        }).catch(error => {
            Alert.error((error && error.message) || 'Oops! Il y a un erreur de saisi . Veuiller saisir une autre fois!');            


<label><input type="radio" value="medecin" name="type" value={this.state.type} onChange={this.handleInputChange} required/>Médecin</label><br/>
                <label id="aaa"><input type="radio" value="Patient"  name="type" value={this.state.type} onChange={this.handleInputChange} required/>Patient</label><br/>
                <label id="aa"><input type="radio" value="Laboratoire" name="type" value={this.state.type} onChange={this.handleInputChange} required/>Laboratoire</label><br/>
                <label id='a'><input type="radio" value="pharmacie"  name="type" value={this.state.type} onChange={this.handleInputChange} required/>Pharmacie</label><br/>

An example of a document stored in database:


Read more here: https://stackoverflow.com/questions/67018051/why-my-app-cant-handle-the-radio-button-selected-value-of-the-form

Content Attribution

This content was originally published by dali hmida at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: