I have a textarea that displays data from a database. When a user enters / changes text in the textarea, 2 tabs characters are added to the beginning of the text. If I look at the entry in the database after form submission, there are no spaces or tabs at the beginning of the text, and if I check the request.form variable when the form submits, there are no spaces or tabs either. Every time that I submit the form, 2 more tab characters are added. Any idea why?
This is the code that populates and updates:
To display:
<%
...open rs
sMemo_text=stripQuotes(rsAgenda(6))
close rs
%>
...
<TEXTAREA id=txtMemo style="WIDTH: 385px; HEIGHT: 108px" name=txtMemo cols=40 rows=15><%=sMemo_text%></TEXTAREA>
...
To update:
strSQL="update ...[rest of sql statement]...
& "Memo_text= "& sqlprep_s(Request.Form("txtText",300) & " " _
If I do a response.write strSQL, there are no spaces at the beginning of the string.
The functions stripQuotes and sqlprep_s are:
Function SQLPrep_s(ByVal StringValue, ByRef MaxLength)
If MaxLength > 0 Then
StringValue = Left(StringValue, MaxLength)
End If
StringValue = Replace(StringValue, "'", "''"
If StringValue = "" Then
SQLPrep_s = "NULL"
Else
SQLPrep_s = "'" & StringValue & "'"
End If
End Function
Public Function StripQuotes(str)
str=trim(str)
if left(str,1)="'" and right(str,1)="'" then
str=mid(str,2,len(str)-2)
end if
StripQuotes=str
end function
Thanks - Greg
This is the code that populates and updates:
To display:
<%
...open rs
sMemo_text=stripQuotes(rsAgenda(6))
close rs
%>
...
<TEXTAREA id=txtMemo style="WIDTH: 385px; HEIGHT: 108px" name=txtMemo cols=40 rows=15><%=sMemo_text%></TEXTAREA>
...
To update:
strSQL="update ...[rest of sql statement]...
& "Memo_text= "& sqlprep_s(Request.Form("txtText",300) & " " _
If I do a response.write strSQL, there are no spaces at the beginning of the string.
The functions stripQuotes and sqlprep_s are:
Function SQLPrep_s(ByVal StringValue, ByRef MaxLength)
If MaxLength > 0 Then
StringValue = Left(StringValue, MaxLength)
End If
StringValue = Replace(StringValue, "'", "''"
If StringValue = "" Then
SQLPrep_s = "NULL"
Else
SQLPrep_s = "'" & StringValue & "'"
End If
End Function
Public Function StripQuotes(str)
str=trim(str)
if left(str,1)="'" and right(str,1)="'" then
str=mid(str,2,len(str)-2)
end if
StripQuotes=str
end function
Thanks - Greg