ArniReynir
ArniReynir

Reputation: 849

Django radiobutton

I'm trying to access the value via Django from the value attribute of radio buttons that is generated by JavaScript. In the Django examples that i have found they use tuples which hard coded choices which doesn't work for me.

I want to do something like this.

formData = request.POST
value = formData[ "radiobuttonName" ].value

Context : Trying to make exam app that allows user to create exam and add as many answers he wants and then select with radio button which answers is right.

Upvotes: 0

Views: 950

Answers (1)

Gareth Rees
Gareth Rees

Reputation: 65894

I'm not entirely sure I've understood your problem, but I think that the dictionary request.POST already contains the values you need. For example, request.POST['radioButton'] is the value attribute of the selected radio button with that name.

Upvotes: 2

Related Questions