Skip to main content
Question

Strip html from formula text field

  • January 10, 2018
  • 0 replies
  • 423 views

The first field on my edit form is "Organization".
This field is set as the field for the form title.
It is a rich text field.
Problem is that the form title displays the name of the organization in the title with all the html code. Yuck.
I'd like to create a formula text field that will read the contents of the Organization field but strip all the html thereby producing 'normal' text.
This topic has been closed for replies.

Can you please share a screenshot of the Organization field? So, I can see the formatting of that field or what formatting you have applied in that rich-text field?

Thanks,
Gaurav

  • Registered
  • January 10, 2018
(Note Tested)

Try creating a formula text field to mirror your [Organization] field.
Use the formula

ToText([Organization])

That might work, but i bet it will still get some weird stuff.

Forum|alt.badge.img+2
I was looking to do the same thing here and stumbled across this post.  I figured I would post this for future users.  It's cumbersome but appears to work.  I just went up to 3 nonspecific tags here just to keep this relatively short but my actual formula has a lot more.


var text Note = ToText([Your Rich Text Field Name]);

//specific tags - can replace them all in note instead of one at a time
var text AST= SearchAndReplace($NOTE,"<br />","");
var text BST= SearchAndReplace($AST,"<p>","");
var text CST= SearchAndReplace($BST,"</p>","");
var text DST= SearchAndReplace($CST,"<strong>","");
var text EST= SearchAndReplace($DST,"</strong>","");
var text FST= SearchAndReplace($EST,"<ol>","");
var text GST= SearchAndReplace($FST,"</ol>","");
var text HST= SearchAndReplace($GST,"<li>","");
var text IST= SearchAndReplace($HST,"</li>","");
var text JST= SearchAndReplace($IST,"</span>","");
var text KST= SearchAndReplace($IST,"&nbsp;"," ");

var text NoteNew = $KST;

//Glossary
//SPT = Start Position Tag
//EPT = Eng Position Tag

// 1st Tag (A)
var number ASPT = (Length(Left($NoteNew,"<")))+1;
var number AEPT = Length(Left($NoteNew,">"))+1;
var number ALength = $AEPT-$ASPT+1;
var text ATag = Mid($NoteNew, $ASPT, $Alength);
var text ANote = SearchAndReplace($NoteNEw,$ATag,"");
//2nd Tag (B)
var number BSPT = (Length(Left($ANote,"<")))+1;
var number BEPT = Length(Left($ANote,">"))+1;
var number BLength = $BEPT-$BSPT+1;
var text BTag = Mid($ANOTE, $BSPT, $Blength);
var text BNote = SearchAndReplace($ANote,$BTag,"");
//3nd Tag (C)
var number CSPT = (Length(Left($BNote,"<")))+1;
var number CEPT = Length(Left($BNote,">"))+1;
var number CLength = $CEPT-$CSPT+1;
var text CTag = Mid($BNOTE, $CSPT, $Clength);
var text CNote = SearchAndReplace($BNote,$CTag,"");
//Add more as needed

$CNote