Formula Text field loses formatting of referenced field

  • 0
  • 2
  • Question
  • Updated 2 years ago
  • Answered
I have a formula text field with HTML enabled that is just doing an If statement and then choosing between 2 existing text fields for its data. What's happening is when the formula text field is displayed, the formatting is lost. I believe what's happening is that it's treating the referenced field as pure text. I couldn't find a function that would preserve the formatting to HTML.

Suggestions?



Edit:

Example text field:

Hello

How are you today?

Results: Hello How are you today?



Formula Text Field:

if(Trim([Field1])="","<span style=\"color:red;\">"&[Field2]&"</span>",[Field1])
Photo of Michael

Michael

  • 10 Points

Posted 3 years ago

  • 0
  • 2
Can you give the formula and an example of what data is in the field in an example record and how its rendering?.
Photo of Michael

Michael

  • 10 Points
Updated OP
So is your question that that you are losing the New Line carriage return when you convert to HTML?
Photo of Michael

Michael

  • 10 Points
Exactly, along with all white space being truncated to a single space. It seems like it's just dumping it out as text and treating the entire field as HTML.
Yes, well, when a text field is in html the white spaces will be compressed to one space and the  \n which is a carriage return type hidden character will not be recognized.  So that formatting will be lost.  Which I guess was your original question.  So we are where we were.
Photo of Michael

Michael

  • 10 Points
Hah! If there was a string replace I could swap the carriage return for an html break but I haven't seen a solution for that so far. Can JavaScript be used in a formula field?
You would have to contact Dan Diebolt  or a QuickBase Solution Provider with that kind of expertise for a non native solution, I suspect.  I don't have an answer for you.
Photo of Michael

Michael

  • 10 Points
Thanks for the help!
Photo of Ursula Ll

Ursula Ll

  • 1,682 Points 1k badge 2x thumb
don't you just need to click the enable HTML checkbox in the field settings? maybe I am not understanding the question