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

97
Views
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 answers
Answer question

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 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!