I'm having this problem and I tried using TRIM to clean up all the empty space but not helping at all, hoping someone can point out why and how I can do this, here is the code:
Basically, my problem is that whenever this page opens, the TEXTAREA keeps include empty line on top and, at least, 2 or 3 lines below of the text; therefore, if I forget to delete those white lines and hit SAVE, the article where I want to display the text content will have those unwanted empty lines with along with the text. As I said, I used TRIM for all of the chances I got, but no help. Is there another way to do just that? Thanks!
Code:
<html>
<%
if request("form00")="1" then
Set mainTxtFileObj = Server.CreateObject("Scripting.FileSystemObject")
Set myOutStream = mainTxtFileObj.OpenTextFile(Server.MapPath("db/mainTxt.txt"), 2, TRUE)
myOutStream.Write(Request.Form("mainStr"))
myOutStream.Close
'Send them back to the default page
Response.Redirect("default.asp")
end if
%>
<body>
<form action="editMainTxt.asp" method="post">
<textarea name="mainStr" cols="50" rows="10">
<%
Set mainTxtFileObj = Server.CreateObject("Scripting.FileSystemObject")
Set mainTxtFile = mainTxtFileObj.OpenTextFile(Server.MapPath("db/mainTxt.txt"))
While NOT mainTxtFile.AtEndOfStream
Response.write(mainTxtFile.ReadLine & vbCrLf)
Wend
mainTxtFile.Close
%>
</textarea>
<BR />
<input type="hidden" name="form00" value="1" />
<input type="submit" value="Save" onclick="window.close()" />
<input type="c"
</form>
</body>
</html>
Basically, my problem is that whenever this page opens, the TEXTAREA keeps include empty line on top and, at least, 2 or 3 lines below of the text; therefore, if I forget to delete those white lines and hit SAVE, the article where I want to display the text content will have those unwanted empty lines with along with the text. As I said, I used TRIM for all of the chances I got, but no help. Is there another way to do just that? Thanks!