I am having a problem with some code. I have looked across the web and at stackoverflow and i cannot see what else i can do to resolve the problem for classic asp.
The issue is that i am trying to remove the case return and line feed from being entered into the XML string however i have encounter a flaw in my code but unsure how to stop this from happening.
function DisableEnter()
{
if (window.event.keyCode == 13)
{
event.returnValue=false;
event.cancel = true;
}
}
This stops the user from entering the “return” key which is great BUT what happens when you copy and paste the text that has enters in them? In my case it bypasses this check and inputs this into the database.
Server.URLEncode(Replace(Replace(Replace(other_info,","," "),"\n",""),"\r",""))
I have entered this replace to try to resolve the \n\r that i noticed in a lot of posts is the symbols for the carriage return and line feed but it still submits?
<td><textarea name="other_info" cols="30" rows="5" id="other_info" onkeypress="DisableEnter()" onkeyup="DisableEnter()"><%=Request("other_info")%></textarea></td>
Therefore basically the question is how do i eliminate new line/carriage return/line feed from being entered into my database that has been copy and pasted therefore when our process of exporting the data to a CSV spreadsheet for another application to read it which must be on 1 line in the cell.
If you require any other information please let me know.
Thanks for your time.
HI here is an example with javascript.
the code is ready to be copy pasted and tested