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

107
Vistas
Why is it printing none in my views for the textarea I'm getting from html?

In the HTML:

<div class="col-md-6">
 <div class="form-group">
  <label for="port_param1">Port Parameter 1</label>
   <textarea class="form-control" name ="port_param1" id="port_param1" rows="5" onkeyup="copy();"  
     placeholder="e.g. For Access Port mode: 
                       switch access vlan 10
                       For Trunk Port mode:
                       switch trunk native vlan 5
                       switch trunk allow vlan 5, 6">
   </textarea>
 </div>
</div>

In the view:

portpara1 = request.POST.get('port_param1')
print(portpara1)

Here I have a textarea within my html for user to type a huge chunk of text. But when I request.POST.get of the textarea and printing it, I am receiving the output of none. Even when i type just one line of words within the textarea, i still get the output of none. So how do i properly get the text keyed in by user on the html to view? And also within the text area, how do i ensure in between rows, the text are seperated with \n when i retrieve it to the view but the user keying in the web is just pressing enter for the next row and not typing \n. Appreciate if anyone can help !

Updated in html (Added a additional text box):

<input type = "text" name = "portpara1" id = "portpara1">

Script:

function copy()
{
   var port_param1 = document.getElementById("port_param1");
   port_param1.replace(/\r?\n/g, '\n')
   var portpara1 = document.getElementById("portpara1");
   portpara1.value = port_param1.value;
}  
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Requests work with textareas and inputs with attribute name, not id. So you should add a name attribute and refer to it in your code.

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