Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

170
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda