Thanks Brad,
that has done the Job. I just wondered that you have to do this
yourself and you are not able to display what you entered in a form.
Norbert Pfaff
Am 10.01.2007 um 16:42 schrieb Brad Perkins:
Norbert Pfaff wrote:
Hi,
I have to display text, which my users enter in a form. In the
form everything is fine, in the database the text is fine, if I
display the text later the text is without structure. No more
line feeds, carriage return etc.
Any tipps?
Norbert,
That is standard behavior. If you need line breaks in HTML you need
to insert a <br />.
I have a simple method called nl2br which I use like this.
write (nl2br($someStructuredText))
nl2br simply replaces carriage returns in the output text with
"<br />";
method "nl2br" ($inTxt)
`
` Converts any instances of carriage return, carriage return/
line feed,
` or line feed characters to the HTML break entity
`
`
$cr := char(13)
$lf := char(10)
$crlf := $cr + $lf
$br := "<br />"
$outTxt := $inTxt
if (position($crlf;$outTxt)>0) `CRLFs?
$outTxt:=replace string($outTxt;$crlf;$br)
end if
if (position($lf;$outTxt)>0) `LFs?
$outTxt:=replace string($outTxt;$lf;$br)
end if
if (position($cr;$outTxt)>0) `CRs?
$outTxt:=replace string($outTxt;$cr;$br)
end if
return ($outTxt)
end method `"nl2br
I've used this method for some time. This functionality might be
built into a standard A4D command now?
-- Brad
_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/
_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/