How can i achieve what I want?

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)

This the following output in my powershell:
image

How do i make it into a single line resulting in 123\n12\n1 Basically before every next line, instead of enter, it is replace with \n

I tried the following:
Added a additional text box in html:

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

And then let view extract the input from the textbox. But it is not working. This is a django forum so how do i do the intended way I want in views? Or if can advise me how do i correct my script in html?

Are you using a Django Form? or are you trying to do it with pure HTML Form?

Nope i am not using Django Form for this part. It is pure HTML form

What is your goal, register the breakline?

Sorry for the late reply. I managed to get it done in HTML. If u interested it is .replace(/(?:\r|\n|\r\n)/g,'\\n'); for the script