Build a survey form-radio groups

Hi, I am running into some problems for this specific requirement.

It need the form to have “Every radio button group should have at least 2 radio buttons.”

I have tried a few different ways for radio group. Like

.... ....

and this is my current code at the bottom:

Your purchase

Who was the purchase for? Myself Friends Family Others
    <label for="services"> How would you rate our product from 1-5? (1=poor, 5=excellent)
        <label for="one">
            <input value="0" id="one" type="radio" name="one" class="inline"/>1
        </label> 
        <label for="two">
            <input value="1" id="two" type="radio" name="two" class="inline"/>2
        </label>
        <label for="three">
            <input value="2" id="three" type="radio" name="three" class="inline"/>3
        </label>
        <label for="four">
            <input value="3" id="four" type="radio" name="four" class="inline"/>4
        </label>
        <label for="five">
            <input value="4" id="five" type="radio" name="five" class="inline" checked/>5
        </label>
    </label>

    <label for="services"> Would you recommend us to others?
        <label for="yes">
            <input value="0" id="yes" type="radio" name="yes" class="inline"/>Yes
        </label> 
        <label for="no">
            <input value="1" id="no" type="radio" name="no" class="inline"/>No
        </label>
        <label for="maybe">
            <input value="2" id="maybe" type="radio" name="maybe" class="inline"/>Maybe
        </label>
    </label>
    
</fieldset>

Does anyone know what I have done wrong?

2 Likes

Hello @WaifuNiko !

For each group that is requiring an answer, give the radio buttons the same name in the input element.

Example:

<input type="radio" value="yes" name="choice">
<input type="radio" value="no" name="choice">

This is so only one button can be clicked, on, and preventing more than one being chosen.

I hope this helps you @WaifuNiko!

2 Likes

oh yes! thank you it’s working!

2 Likes

Happy to help you progress in your coding journey @WaifuNiko !

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.