One of FileMaker’s great strengths in the ability to convert a standard layout into a web page. Instant Web Publishing is a great way to get a database driven web site up and running if you have no knowledge on how to build a web site and connect it to a database.
However as with all great quick and easy solutions there will always be a point where you need a feature that is not available.
Text formatting is one of these features easy to do in FileMaker but cannot be done in IWP so if this is a must have feature what are the options?
Create a web site, say in PHP, and link it to the FileMaker database.
There is a HTML markup editor from Tinymce which can be used within a PHP script.
So how to use a PHP script in IWP.
FileMaker’s built in Web viewer function works in IWP so you end up with a page within a page. Point the web viewer at a PHP web server and the text editor is available to all. This works in FileMaker as well as IWP so the user experience is still the same.
There are a few things you need to do to get the formatting to move between web HTML styles and FileMakers internal rendering.
First the text editor requires CSS marked up text so for your field “Formatted_Text” you need another field “CSS_Text” set to auto enter, replace current contents – GetasCSS( Formatted_Text )
After you have edited the text and click the save button we need to get the data back from “CSS_Text” into “Formatted_Text”
So next we get the Save button to run a FileMaker script that sets “Formatted_Text”.
But how to convert the CSS based HTML into FileMaker formatting. A quick search of the web and you will find custom functions that convert CSS to FileMaker and HTML to FileMaker. On trying these none of them did the whole job. So I settled on using a function from Chaim Bacon @ Productive IT (UK) Ltd called CF_HTMLtoFMP_styledText and one from Christopher Gauntt @ Cordega Solutions called CSStoFMText.
The field “Formatted_Text is set to CF_HTMLtoFMP_styledText ( CSStoFMText ( text ) ; 1 )
I then had to tweak the CF_HTMLtoFMP_styledText to remove empty tags and update a few of the tags from html to css i.e. to .
The result is a FileMaker styled field that can be edited on the web with only one PHP script written.