Skip to main content
Question

Rich Text Syntax

  • October 20, 2021
  • 0 replies
  • 347 views

Forum|alt.badge.img+14
This is something simple, but I still feel like I'm not doing this in the cleanest way. Below is an example of some basic red text in italics.

"<span style='font-size:12px;color:#e61515'><i>words are going here</i></span>"

I simply want to be able to make the style a var text, so that in complicated fields I can clean up my coding. I found something that works, but I'm not convinced it is the cleanest method. Still feels like too many single and double quotes. Anyone use a nicer/cleaner syntax?

var text Style = font-size:12px;color:#e61515;

"<span style='" & $Style & "'><i>words are going here</b></span>"

For example, anyone have clean syntax for changing the color of text in the middle of a sentence and then changing it back? I can make it work, but I feel like my version is too clunky and long.

------------------------------
Michael Tamoush
------------------------------

You're very close.  Try:

var text Style = "\"font-size:12px;color:#e61515\"";

I've wanted to set my styles as app variables.  Sharon Faust aka Quickbase Junkie has a video on doing just that, but I haven't made time to make those changes yet

------------------------------
Paul Peterson
------------------------------

  • Registered
  • October 21, 2021
If you're only intending to use the style for one specific phrase, I'd go with something like this:
var text words = "<span style='font-size:12px;color:#e61515'><i>words are going here</i></span>";
"word word word " & $words & " word word word"

If you want to repeat the styling, try this:
var text startTags = "<span style='font-size:12px;color:#e61515'><i>";
var text endTags = "</i></span>";
"word word word " & $startTags & " words are going here " & $endTags & " word word " & $startTags & "yet more words" & $endTags & " word."

------------------------------
Ahuva Brown
------------------------------