[Django]-How to access radio button selected value in Django

3👍

I guess this is mostly because you are enclosing the <input> tag inside the <label> tag.Also you must give the for attribute for and put the input element’s id in the <label> tag

Try like this:

<label class="btn btn-secondary" for="option60">60 seconds</label>
<input type="radio" name="timeoptions" id="option60" autocomplete="off" value="60"> 

You can do this for all the radio buttons.Then in your view you can access with TimeOut = request.POST.get('timeoptions')

Leave a comment