Background:
asp page using vbscript, html and javascript
I have a textarea (varchar 1000) that is used for (1) comment data entry, (2) comment edit or (3) comment display (which is read only).
On submit (submit button) a javascript validation function fires. The javascript blows up if the input person hit 'enter' when entering the comment thus creating a hard carriage return. In the javascript the closing quote of the comment literal is being thrown to the next line and the javascript error indicates that 'the closing quote is missing'.
Below is the code that I wrote to handle the carriage return issue but I'm getting an internal server error on the replace statement: strOriginalCommentText=Replace(strOriginalCommentText),CRLF,"\n"
which is the 15th line from the bottom of this post.
I'd appreciate it if you'd see if you can see what I'm doing wrong. Thank you.
Please let me know if you need any further information. Now the code excerpts:
---------------
Option Explicit
Dim glStrConn, CRLF
-------------------
<!--"E" = edit, "R" and "AC" are add actions-->
<% if glAction = "E" then %>
<textarea name="txtCommentText" cols="30" rows="5" wrap="virtual" class="toUpper"><%=strCommentText%></textarea>
<% elseif glAction = "R" then %>
<textarea name="txtCommentText" cols="30" rows="5" wrap="virtual" class="toUpper"><%=strCommentText%></textarea>
<% elseif glAction = "AC" then %>
<textarea name="txtCommentText" cols="30" rows="5" wrap="virtual" class="toUpper"><%=strCommentText%></textarea>
.......
end if
----------------------
Sub getCommentsRecord()
on error resume next
Dim objRs
Dim inPars(4)
inPars(0) = strTxId
inPars(1) = strCommentType
inPars(2) = strCommentSeq
inPars(3) = strOwnerType
inPars(4) = strOwnerSeq
Dim i
For i = 0 To UBound(inPars)
Response.Write "get comments parms"
Response.Write("inPars(" & i & "
= " & inPars(i) & "<BR>" )
Next
Set objRs = objBepmDbSp.getRecords(CStr(glStrConn), "kcs3764.sp_Comment_Get", inPars)
If NOT ( objRs.BOF And objRs.EOF ) Then
strTxId = objRs.Fields("Tx_Id"
.Value
strCommentType = objRs.Fields("Comment_Type"
.Value
strCommentSeq = objRs.Fields("Comment_Seq"
.Value
strOwnerType = objRs.Fields("Owner_Type"
.Value
strOwnerSeq = objRs.Fields("Owner_Seq"
.Value
strCommentText = objRs.Fields("Comment_Text"
.Value
strRebuttalStatus = objRs.Fields("Rebuttal_Status"
.Value
strStatus = objRs.Fields("Status"
.Value
strCreatedBy = objRs.Fields("Created_By"
.Value
dtCreatedDate = objRs.Fields("Created_Date"
.Value
strActionBy = objRs.Fields("Action_By"
.Value
dtEndDate = objRs.Fields("End_Date"
.Value
strOriginalCommentText = strCommentText
pComment text = hCommentText
CRLF = Chr(13) & Chr(10)
strOriginalCommentText = Replace(strOriginalCommentText),CRLF,"\n"
Response.Write("in get comm commtext =" & strCommentText & "<br>"
Response.Write("in get comm origcommtext =" & strOriginalCommentText & "<br>"
Else
Response.Write("No records found for given criteria"
End If
objRs.Close
If Not objRs is Nothing Then
Set objRs = Nothing
End If
End Sub 'getCommentsRecord
asp page using vbscript, html and javascript
I have a textarea (varchar 1000) that is used for (1) comment data entry, (2) comment edit or (3) comment display (which is read only).
On submit (submit button) a javascript validation function fires. The javascript blows up if the input person hit 'enter' when entering the comment thus creating a hard carriage return. In the javascript the closing quote of the comment literal is being thrown to the next line and the javascript error indicates that 'the closing quote is missing'.
Below is the code that I wrote to handle the carriage return issue but I'm getting an internal server error on the replace statement: strOriginalCommentText=Replace(strOriginalCommentText),CRLF,"\n"
I'd appreciate it if you'd see if you can see what I'm doing wrong. Thank you.
Please let me know if you need any further information. Now the code excerpts:
---------------
Option Explicit
Dim glStrConn, CRLF
-------------------
<!--"E" = edit, "R" and "AC" are add actions-->
<% if glAction = "E" then %>
<textarea name="txtCommentText" cols="30" rows="5" wrap="virtual" class="toUpper"><%=strCommentText%></textarea>
<% elseif glAction = "R" then %>
<textarea name="txtCommentText" cols="30" rows="5" wrap="virtual" class="toUpper"><%=strCommentText%></textarea>
<% elseif glAction = "AC" then %>
<textarea name="txtCommentText" cols="30" rows="5" wrap="virtual" class="toUpper"><%=strCommentText%></textarea>
.......
end if
----------------------
Sub getCommentsRecord()
on error resume next
Dim objRs
Dim inPars(4)
inPars(0) = strTxId
inPars(1) = strCommentType
inPars(2) = strCommentSeq
inPars(3) = strOwnerType
inPars(4) = strOwnerSeq
Dim i
For i = 0 To UBound(inPars)
Response.Write "get comments parms"
Response.Write("inPars(" & i & "
Next
Set objRs = objBepmDbSp.getRecords(CStr(glStrConn), "kcs3764.sp_Comment_Get", inPars)
If NOT ( objRs.BOF And objRs.EOF ) Then
strTxId = objRs.Fields("Tx_Id"
strCommentType = objRs.Fields("Comment_Type"
strCommentSeq = objRs.Fields("Comment_Seq"
strOwnerType = objRs.Fields("Owner_Type"
strOwnerSeq = objRs.Fields("Owner_Seq"
strCommentText = objRs.Fields("Comment_Text"
strRebuttalStatus = objRs.Fields("Rebuttal_Status"
strStatus = objRs.Fields("Status"
strCreatedBy = objRs.Fields("Created_By"
dtCreatedDate = objRs.Fields("Created_Date"
strActionBy = objRs.Fields("Action_By"
dtEndDate = objRs.Fields("End_Date"
strOriginalCommentText = strCommentText
pComment text = hCommentText
CRLF = Chr(13) & Chr(10)
strOriginalCommentText = Replace(strOriginalCommentText),CRLF,"\n"
Response.Write("in get comm commtext =" & strCommentText & "<br>"
Response.Write("in get comm origcommtext =" & strOriginalCommentText & "<br>"
Else
Response.Write("No records found for given criteria"
End If
objRs.Close
If Not objRs is Nothing Then
Set objRs = Nothing
End If
End Sub 'getCommentsRecord