Skip to content
Advertisement

How to get Radio Radio Button Data from POST Request Data in an HTML form?

So I’m coding a test platform consisting of Multiple Choice Questions ( MCQs ) in Django. Everything is working fine but somehow I think that the radio button value from my question page is not getting fetch via POST request.

Would appreciate some help!

Here are my models :

JavaScript
JavaScript

Here are my views :

JavaScript

Here’s my question page :

JavaScript

I’ve been trying different things so there might be some discrepancies. The score is not getting updated even after clicking the correct Choice.

Advertisement

Answer

When an input box is checked this returns ‘on’. Here is what you need:

in views.py

JavaScript

in form.html

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement