March 14, 200817 yr 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 March 14, 200817 yr by Guest
March 14, 200817 yr 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');
March 17, 200817 yr 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.
March 23, 200817 yr 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