Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

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');

  • Author

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.

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.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.