You do not need to include Response.Write if you use the equal sign. The code <%=TIME()%> is equivalent to <%Response.Write(TIME())%>. You were right about the parentheses -- the original code was missing a few. Here's a corrected version of the code, using the equal sign method:
<%=STRTRAN(STRTRAN(STRTRAN(Server.HTMLEncode(clientmemo), CHR(13) + CHR(10), "<BR>"), CHR(13), "<BR>"), CHR(10), "<BR>")%>
Sent by John Waite on 02/10/2002 11:21:02 AM:
Dear Foxweb Support,
I understand the purpose behind this code but I can't make it work.
I wrote a very simple test so I could copy it to you:
*****************************************************
<%
USE clients
SELECT * FROM clients WHERE clientnr = 8763 INTO CURSOR crsTest
%>
<html>
<head>
<title>Test HTMLEncode</title>
</head>
<body>
Just testing
<BR><BR>
<%=STR(clientno)%> && OK
<BR><BR>
<%=clientmemo%> && OK but all together and no line breaks
<BR><BR>
<%=Response.Write(STRTRAN(STRTRAN(STRTRAN(Server.HTMLEncode(clientmemo), CHR(13) + CHR(10), "<BR>", CHR(13), "<BR>", CHR(10), "<BR>")%>
</body>
</html>
*******************************************************
I get the following error message:
Error #: 16
Message: Unrecognized command verb.
Program: C:\BUGLE\TEST.FXP
Line #: 29
Line: =Response.Write(STRTRAN(STRTRAN(STRTRAN(Server.HTMLEncode(clientmemo), CHR(13) + CHR(10), "<BR>", CHR(13), "<BR>", CHR(10), "<BR>")
I tried with both <%Response.Write ...%> & <%=Response.Write ...%>, as I wasn't sure which to use, to say nothing of other combinations, but had no luck.
I am doing something very simple and wrong?
The repetition of STRTRAN in your code and the presence of 9 "(" and only 5 ")" seemed rather strange to me.
I look forward to hearing from you.
All the best.
John Waite
Sent by FoxWeb Support on 02/05/2002 07:42:54 PM:
You need to HTML-Encode the contents of the memo field and then you need to replace carriage return and line feed characters with <BR> tags:
Response.Write(STRTRAN(STRTRAN(STRTRAN(Server.HTMLEncode(memo), CHR(13) + CHR(10), '<BR>', CHR(13), '<BR>', CHR(10), '<BR>')
Note that the above code first replaces CRLF combinations and then handles individual CR and LF characters. This avoids double <BR> tags being added for CRLF combinations, which normally display as a single line break.
FoxWeb Support Team
support@foxweb.com
Sent by John Waite on 01/31/2002 07:47:53 AM:
Dear Forum,
I cannot find a way to get notes made in a Foxpro memo to display correctly in HTML with line breaks as in the original.
Example:
-------------------------------------------------------------------------------------------------
In the Foxpro memo field:
-------------------------------------------------------------------------------------------------
Bestellung 13.5.88. Rückantw. 11/88. Rückantw. 1/89. Rückantw. 3/89 (Anfr.). Rückantw. 10/90. St.Lt Rf rec. & Req.lists sent SP & Lt. JW 05.96
St.lt.lists sent 05.97 VS
E-mail reply to SLC 29.6.97; thanks have rec'd lists. VS
-------------------------------------------------------------------------------------------------
This will display fine in a <TEXTAREA> within a form, but if I wish to display it as simple output e.g.
<TABLE ALIGN="center" WIDTH="592" CELLSPACING="0" CELLPADDING="2" BORDER="0"><TR>
<TD BGCOLOR="#F5F5F5"><%=memofield%></TD>
</TR></TABLE>
The breaks are ignored and I get:
-------------------------------------------------------------------------------------------------
Bestellung 13.5.88. Rückantw. 11/88. Rückantw. 1/89. Rückantw. 3/89 (Anfr.). Rückantw. 10/90. St.Lt Rf rec. & Req.lists sent SP & Lt. JW 05.96. St.lt.lists sent 05.97 VSE-mail reply to SLC 29.6.97; thanks have rec'd lists. VS
-------------------------------------------------------------------------------------------------
If I use <PRE>, e.g.
<TABLE ALIGN="center" WIDTH="592" CELLSPACING="0" CELLPADDING="2" BORDER="0"><TR>
<TD BGCOLOR="#F5F5F5"><PRE><%=memofield%></PRE></TD>
</TR></TABLE>
the lines shoot off for miles to the right and I am unable to get them to wrap.
Well, I hope you understand!
Any help much appreciated.
Best wishes to all forum users.
John