[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: use a gambas web cgi in a phpBB forum


On 11/28/25 4:58 AM, Bruce Steers wrote:
The main issue is with phpBB the token {TEXT} is used to insert the text but it has line feeds and can't be formatted another way.

Why can't it be formatted another way? Have you tried 'var txt = encodeURI("{TEXT}");' ?


So code like 'var txt = "{TEXT)";
Inputs exactly like..
var txt = "line 1
Line 2
Line 3";

That would work in a bash script but JavaScript can't do multiline strings like that.

A multiline string is just a string with LF characters in it, and JavaScript absolutely *can* do multiline strings. The following HTML/Javascript code demonstrates that:

[code]
<!DOCTYPE html>
<head>
<style>
    textarea {
        border-style: solid;
        font-size: x-large;
    }
</style>
</head>
<body>
<textarea id="raw" cols=10 rows=4></textarea>
<br><br>
<textarea id="encoded" cols=30 rows=1></textarea>
<script>
    var txt = `Hello\nyou\nbeautiful\nworld!`;
    document.getElementById("raw").value=txt;
    document.getElementById("encoded").value=encodeURI(document.getElementById("raw").value);
</script>
</body>
</html>
[/code]

Maybe JavaScript can't do multiline strings the way *you're* trying to do it. :-P


--
Lee

--- Gambas User List Netiquette [https://gambaswiki.org/wiki/doc/netiquette] ----
--- Gambas User List Archive [https://lists.gambas-basic.org/archive/user] ----


Follow-Ups:
Re: use a gambas web cgi in a phpBB forumBruce Steers <bsteers4@xxxxxxxxx>
References:
use a gambas web cgi in a phpBB forumBruce Steers <bsteers4@xxxxxxxxx>
Re: use a gambas web cgi in a phpBB forumLee <t.lee.davidson@xxxxxxxxx>
Re: use a gambas web cgi in a phpBB forumBruce Steers <bsteers4@xxxxxxxxx>