Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

169
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda