Get the "id" value for radio button in python

1.6k Views Asked by At

I use python with bottle, my tpl file contains the radio button:

<div class="radio">
        <label>
              <input type="radio" name="optionsRadios" id="option1" value="{{result}}" >
              {{result}} 
        </label>
</div>

I want to get the radio button "id" and "value". I returned the radio button value in my py page:

output = request.forms.get('optionsRadios')

Is it possible to get the "id" for the selected radio button?

1

There are 1 best solutions below

1
On BEST ANSWER

No. An HTTP form submission contains only the name and the value of each form field. Put the ID into the value (along with any other value you need to have there). Ideally the ID and the value would be the same, or similar enough that you can easily derive one from the other.