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

  • SEARCH
  • Home
  • 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 8898523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:38:05+00:00 2026-06-15T00:38:05+00:00

In my Django app, I would like to use Twitter bootstrap radio buttons. Then

  • 0

In my Django app, I would like to use Twitter bootstrap radio buttons. Then I would like to post the value of those buttons in order to create an object.

Here is my buttons:

  <div class="btn-group" data-toggle="buttons-checkbox">
  <button type="button" class="btn" name="supporting">Team1</button>
  <button type="button" class="btn" name="supporting">Team2</button>
  </div>


  <div class="span6 btn-group ib" data-toggle="buttons-radio">
       <button type="button" class="btn btn-primary active" name="style">relaxed</button>
       <button type="button" class="btn btn-primary active" name="style">strict</button>
  </div>



  <input type="submit" value="create your match">

I would like to get the information from those radio button and create an object match with it in a view:

   def test(request):
       user=request.user
       if request.method == 'POST':
       style = request.POST['style']
       supporting = request.POST['supporting']
       match = Match.objects.create(user=user, style=style, supporting=supporting)
     return HttpResponse(test)

The thing is that I don’t know JavaScript well, so I didn’t find how to get the value from the button.

Then, I think I have to use:

 $.post('/sportdub/points_dub/', {'style': style , 'supporting': supporting});

But how can I do so that style and supporting correspond to the value of the buttons, and then to post it only when the user clicks on the button?

Thank you very much for your help.

  • 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-06-15T00:38:06+00:00Added an answer on June 15, 2026 at 12:38 am

    After your most recent comment, I think you should try using the input radio buttons provided in HTML. It is very easy to do button groupings, make labels for the inputs, and retrieve which one has been clicked.

    Altering your HTML slightly to look like this (the for attribute of the label allows the user to be able to click the label and select the radio button instead of clicking on the button directly):

      <div>
        <input id="team1" type="radio" name="supporting" value="Team1" /><label for="team1">Team 1</label>
        <input id="team2" type="radio" name="supporting" value="Team2" /><label for="team2">Team 2</label>
      </div>
      <div>
        <input id="relaxed" type="radio" name="style" value="relaxed" /><label for="relaxed">Relaxed</label>
        <input id="strict" type="radio" name="style" value="strict" /><label for="strict">Strict</label>
      </div>
    

    I can get which selections have been made using this:

    $('input[name="supporting"]').filter(':checked').val();
    $('input[name="style"]').filter(':checked').val();
    

    If you still wish to use buttons, class active is added to a radio button when clicked. To get the button text, try:

    $('button[name="supporing"]').filter('.active').text();
    $('button[name="style"]').filter('.active').text();
    

    To put this value into a hidden input, do the following:

    $('#hiddenInput1').val($('button[name="supporting"]').filter('.active').text());
    $('#hiddenInput2').val($('button[name="style"]').filter('.active').text());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im would like to use the cool app Django-AdZone, i thinks is a nice
I have a Django web app that I would like to use in a
I try to create a django app that uses webcam. I would like people
I would like to use the JQuery UI tabs in my Django app but
We would like to use Google App Engine for a Django project for rapid
I am using matplotlib in a django app and would like to directly return
I would like to output debug messages in my django app at different points
I am writing a set of django apps and would like to use Hg
In my Django app I display a list of facebook friends. I would like
I would like to have a global variable in my django app that stores

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.