Dynamic page text formatting issues

Would really like an expert to weigh in on this issue so that I don’t have to end up either kludging some solution or hand editing one hundred issues.

I don’t seem to be able to get a response on this that I comprehend.


I would like to (on my dynamic page), generate a text section that has multiple paragraphs - that is, text separated by linefeed/carriage returns. I would like these paragraphs to appear in the font and size and color of my dynamic page.

That is, I would like to be able to store in my database cells something like this …

"The quick red fox jumped over the lazy brown dog.

The lazy brown dog jumped over the quick red fox."

… and have it appear on my page (with the page’s font and color attributes) with the corresponding linefeed and carriage return.

Regular database text cells seem to eliminate special characters like this and result in

The quick red fox jumped over the lazy brown dog. The lazy brown dog jumped over the quick red fox.


Going to rich text necessitates that I hand edit EVERY cell with the desired font/color/size etc … for every entry which seems to defeat the purpose of dynamically generating a page. The default text of times 15 or proxima 15 in black requires changing.

So, for every instance of my dynamic pages, I would have to edit all my text cells and change my font/color/size to keep them consistent. And then of course, if I changed my design, I would have to go in and re-edit them all to match the page.


I am trying to understand if:

  1. There is some way to set default attributes for a rich text database column to address this type of issue OR preferably,
  2. embed some escape character sequence into a normal text cell that gets translated to a real
    carriage return and line feed when the text is picked up dynamically.

I have noticed the database occasionally forgets edit changes to column properties and so have lost a lot of work and am exasperated that there is not a way to address this issue.

Has anyone else successfully dealt with this problem? Trying to make use of generating many pages with text, but using carriage returns and line feeds?

Thank you,
Deborah

You are right, using plain text removes breaklines and rich texts will force you to work hard on recreating page’s formatting.

I thought of a workaround that might help.
you can use the dataset’s onReady API that will let you know when texts has been populated successfully and manually find & replace a special character that you put in the text (with regular text in DB)

Here is an example, I added
in my database wherever i wanted a line break.

$w.onReady(function () {
    $w("#myDataset").onReady( () => {
        $w("#myTextfield").text = reformat($w("#myTextfield").text);
    } );
});


function reformat(t){
 return t.replace(/<br>/g, "\n");
}

hope this helps.

Thank you for thinking about this and confirming my issue. I’ll consider this workaround. The lack of carriage return/new line seems so fundamental to me that I am reluctant to edit 100s of text entries just to get functionality which seems pretty basic or could be addressed by applying a default to the rich text column.

Note that a companion issue to this is that if you have a rich text column and decide to change it back to plain text, the formatting also gets converted and inserted inline into your text and you are stuck with a bunch of plain text formatting commands in text.

Sigh.

Could there be another workaround in that you use rich text (using the proxima default) and then substitute another color, font, and size on ready? Or would this end up being too slow.

Looking for something that need only be code/input one time rather than for hundreds of entries.

you can of course use the same method and wrap the text with styling tags.
should not slow things down, especially if we are talking on one paragraph per page.