Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to get id ("not name") of a radio button via POST request in Django?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 303
    Answer it
      <div class="form-check">
      <input class="form-check-input" type="radio" name="q1" id="q1a">
      <label class="form-check-label" for="q1a">
        A story teller
      </label>
    </div>
    <div class="form-check">
      <input class="form-check-input" type="radio" name="q1" id="q1b" >
      <label class="form-check-label" for="q1b">
        A problem solver
      </label>
    </div>

    In the above code the name of the radio button is q1 which I can access by,

    sq1 = request.POST.get('q1',"off") in views.py

    but, I want to access it specifically by id 

    so if I use 

    w1a = request.POST.get('q1a',"off") it is giving me no value

    HOW CAN I GET IT BY ONLY ID?

     

 0 Answer(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: