I am doing a django project.
But I wanted to have radio buttons grouped as well as name of the buttons to work with django.
Is it okay to use two name attributes in one HTML tag?
Will I be facing any errors if I do so?
Below is my code I am stuck in.
<input type="radio" name="group1" name="removePunc"> Remove Punctuations
<br>
CodePudding user response:
Input name
attributes must be unique to send data using traditional forms. If you find yourself needing more attributes, use the data-
attributes. Pls share some code to undertand what you are trying to achieve.
CodePudding user response:
If you want to label the group of radio buttons add to all of the radio buttons instead of
name="group1"
.
<label for="removePunc">Remove Punctuations</label>
<input type="radio" name="removePunc">
<label for="button2">Button 2</label>
<input type="radio" name="button2">
<label for="button3">Button 3</label>
<input type="radio" name="button3">