Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6614791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:22:53+00:00 2026-05-25T20:22:53+00:00

I currently have a template containing an html form, with the lines: {% for

  • 0

I currently have a template containing an html form, with the lines:

{% for r in q1.responseoption_set.all %}
     <span class="r"><input type="{{ q1.answer_type }}" name="r{{ r.id }}" id="r{{ forloop.counter }}"/>
     <label {% if q1.answer_type == "text" %}class="textanswer"{% endif %}for="r{{ forloop.counter }}">{{ r.text }}</label></span><br>
{% endfor %}

problem is, because they don’t all have the same name (that’s why, right?), if I pick a radio button, and then switch to another one, the first one still shows as selected.

However, at the moment, I need them to all have different names because I need to be able to identify the choices within my view, and as far as I can tell, all I can get from the request is [name, value], e.g. [r200, “on”]

The only way around this that I can think of is to insert a script that assigns a check event to each button, and then, once checked, inserts a hidden input with the name I want, but that seems messy.

SO, is there a way for me to either:
get the button id from the request OR have the buttons “refresh” somehow as they are.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:22:54+00:00Added an answer on May 25, 2026 at 8:22 pm

    Keep the name the same, and set the value for each input choice to the answer id.

    {% for r in q1.responseoption_set.all %}
         <span class="r"><input type="{{ q1.answer_type }}" name="{% questionId %}" value="r{{ r.id }}" id="r{{ forloop.counter }}"/>
         <label {% if q1.answer_type == "text" %}class="textanswer"{% endif %}for="r{{ forloop.counter }}">{{ r.text }}</label></span><br>
    {% endfor %}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently, I have some code as follows template<typename Type> Type* getValue(std::string name, bool tryUseGetter
I'm building a Wordpress template from an HTML page. I currently have <?php $queried_post
I currently have a vector using my template as its type: vector<hashData> myTable; hashData
So I have this template design that is currently absolutely positioned, but I'm trying
I have created a template for Visual Studio 2008 and it currently shows up
I currently have two apps: app1/ app2/ templates/ app1.html app2.html In app1.html, I'm including
I currently have a function template, taking a reference, that does something in essence
I have an interesting problem. I currently have a basic template library that renders
I have a form which is like: class Address_info_updateForm(forms.Form): street = forms.CharField(label=_(Street), required=True) street2
I have a class that requires a boost::variant containing shared pointers to various types

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.