Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

168
Views
Input default values not Displaying in Django through post method

i am working on project in which i have to used python to make blind person to access their account so when they speak there name i want to display it on input field in forms using djangomy view for register

And beolow is my html code in which i have used ajax to make post request to server

    <form action="" method="post" >

        <div class="form-group" align="center">

              <input type="text" name="Email" class="form-control"  value="{{ email }}" readonly placeholder="Email Id" id="myNumber" >
        </div>
          
           </br>

        <a type="submit" class="btn btn-success btn-lg rounded-pill" href='{% url 'menu' %}' >Submit</a>
        </form>


  </div>
###### here i have used id to change default input value####### document.getElementById('myNumber').value = "{{ email }}"; ###### here is the function to make post call ####### function SendPostRequestHome(event){ $.ajax({ url: "{% url 'register' %}", method:"POST", data: { 'csrfmiddlewaretoken': '{{ csrf_token }}'}, success: function (data) { if(data.result == 'success'){ window.location = "{% url 'menu' %}"; } else if(data.result == 'failure'){ window.location = "{% url 'home' %}"; } } }); }

but when i run it work fine but it doesnt display anything on the input field it take input and save it in email variable if print it shows it but not displaying in input field plz answer

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You are assigning value to context dictionary on POST method so in GET method the dictionary is empty so you are sending None in your register view function to the input page. You should take care of the GET method and fill the values according to it.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!