Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6081 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted (edited)

Hello,

I'm in need of converting a text box on my layout to produce some minor html to format basic things like underline, bold and italics. I've tried using GetAsCSS, but it makes the code a little dirty (having lots of extra SPAN things in it), and I've tried Bob Weavers code

Text it will show up in the browser's source code as

Let([ 

k=TextField;

 a=Substitute(GetAsCSS ( k ); ["";""];[""";"""];["“";"“"];["”";"”"];

 ["<";""&Let([T="<"]; 

 [">";">"; 

S=PatternCount(T;"SPAN"); 

X=PatternCount(T;""); 

B=MIN(1;PatternCount(T;"WEIGHT: BOLD")); 

I=MIN(1;PatternCount(T;"STYLE:ITALIC")); 

U=MIN(1;PatternCount(T;"DECORATION:UNDERLINE"))]; 



 Case(X;T;S AND (B OR I OR U);"";S;"";T))&""]); 

 b=Evaluate("""&a&"""); 

 c="""&Substitute(b; ["";""];[""";"""];["“";"“"];["”";"”"];

 ["";""&Let([b="";T="[b][i][u]"]; 

 ["";""&Let([b="[/b][/i]";T="[b][i]"]; 

 ["";""&Let([b="[/b][/u]";T="[b][u]"]; 

 ["";""&Let([b="[/i][/u]";T="[i][u]"]; 

 ["";""&Let([b="[/b]";T=""]; 

 ["";""&Let([b="[/i]";T=""]; 

 ["";""&Let([b="[/u]";T=""]; 

 ["";""&Let([b="";T=""]; 

 ["  ";""];T&:&""])&"""

 ]; 

Evaluate ( c )

 ) 


But I just get a question mark in my text box.

Bob's way would be the preferred way, but either way, when my browser goes to render the field, it converts the ASCII characters to text and doesn't render them as html. i.e. if it shows up in FM as 
<SPAN STYLE= "" >Text</SPAN>

Any help on Bob's function or on getting the html right would be appreciated.

jon

Edited by Guest
Posted

Span tags are not "dirty". and so on and so forth are all essentially deprecated.

Anyway, how are you trying to export your field contents? If you're actually using the API as the forum suggests, then use getFieldUnencoded('fieldname');

Posted

Thank you for the unencoded part, that's what I needed.

Sorry, I'm a little particular about my code. When I have in there for no reason at all, it urks me. I think its bad form and not needed.

Posted

Sorry, I'm a little particular about my code. When I have in there for no reason at all, it urks me. I think its bad form and not needed.

True, but at the end of the day, if that's what you get given with FM, there's no real reason to try and fix it - the deficiencies provided by that take .0001 for a HTML renderer to deal with.

If you wish, it would be better to simply parse the tags with a CF and remove the tags.

This topic is 6081 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.