Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Textarea Carrier Control Scripting is not Working

Status
Not open for further replies.

Coder7

Programmer
Oct 29, 2002
224
US
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

-------------------
<!--&quot;E&quot; = edit, &quot;R&quot; and &quot;AC&quot; are add actions-->
<% if glAction = &quot;E&quot; then %>
<textarea name=&quot;txtCommentText&quot; cols=&quot;30&quot; rows=&quot;5&quot; wrap=&quot;virtual&quot; class=&quot;toUpper&quot;><%=strCommentText%></textarea>
<% elseif glAction = &quot;R&quot; then %>
<textarea name=&quot;txtCommentText&quot; cols=&quot;30&quot; rows=&quot;5&quot; wrap=&quot;virtual&quot; class=&quot;toUpper&quot;><%=strCommentText%></textarea>
<% elseif glAction = &quot;AC&quot; then %>
<textarea name=&quot;txtCommentText&quot; cols=&quot;30&quot; rows=&quot;5&quot; wrap=&quot;virtual&quot; class=&quot;toUpper&quot;><%=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 &quot;get comments parms&quot;
Response.Write(&quot;inPars(&quot; & i & &quot;) = &quot; & inPars(i) & &quot;<BR>&quot; )
Next

Set objRs = objBepmDbSp.getRecords(CStr(glStrConn), &quot;kcs3764.sp_Comment_Get&quot;, inPars)

If NOT ( objRs.BOF And objRs.EOF ) Then
strTxId = objRs.Fields(&quot;Tx_Id&quot;).Value
strCommentType = objRs.Fields(&quot;Comment_Type&quot;).Value
strCommentSeq = objRs.Fields(&quot;Comment_Seq&quot;).Value
strOwnerType = objRs.Fields(&quot;Owner_Type&quot;).Value
strOwnerSeq = objRs.Fields(&quot;Owner_Seq&quot;).Value
strCommentText = objRs.Fields(&quot;Comment_Text&quot;).Value
strRebuttalStatus = objRs.Fields(&quot;Rebuttal_Status&quot;).Value
strStatus = objRs.Fields(&quot;Status&quot;).Value
strCreatedBy = objRs.Fields(&quot;Created_By&quot;).Value
dtCreatedDate = objRs.Fields(&quot;Created_Date&quot;).Value
strActionBy = objRs.Fields(&quot;Action_By&quot;).Value
dtEndDate = objRs.Fields(&quot;End_Date&quot;).Value
strOriginalCommentText = strCommentText
pComment text = hCommentText
CRLF = Chr(13) & Chr(10)
strOriginalCommentText = Replace(strOriginalCommentText),CRLF,&quot;\n&quot;)

Response.Write(&quot;in get comm commtext =&quot; & strCommentText & &quot;<br>&quot;)
Response.Write(&quot;in get comm origcommtext =&quot; & strOriginalCommentText & &quot;<br>&quot;)

Else
Response.Write(&quot;No records found for given criteria&quot;)
End If
objRs.Close

If Not objRs is Nothing Then
Set objRs = Nothing
End If

End Sub 'getCommentsRecord
 
I only showed the Dim for CRLF but I did also declare strCommentText and strOriginalCommentText per below, just fyi.
---------------

Option Explicit

Dim glAction, strglAction, glStrLoginId
Dim strTxId, strCommentType, strCommentSeq
Dim strOwnerType, strOwnerSeq, strCommentText, strOriginalCommentText, strRebuttalStatus
Dim strCreatedBy, dtCreatedDate, strStatus, dtEndDate, strActionBy
Dim glStrConn, CRLF
 
You have the wrong number of )

strOriginalCommentText = Replace(strOriginalCommentText),CRLF,&quot;\n&quot;)

Try

strOriginalCommentText = Replace(strOriginalCommentText,CRLF,&quot;\n&quot;)
Thanks,

Gabe
 
Thank you!! That error is gone now, so I can augment the rest of the code and test.

I couldn't see that.

[bigglasses]



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top