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;
}