AnsweredAssumed Answered

Web Viewer Data URL Problem

Question asked by BruceR on Jan 26, 2009
Latest reply on Aug 25, 2011 by dhafitch


Web Viewer Data URL Problem

Description of the issue

I have created a zero-plugin Web Viewer interaction example.It illustrates an interesting technique, but also illustrates what appears to be some text encoding problems that are encountered when using the data URL with web viewer. Note that this example shows just one way those problems crop up. The basic problem is that many javascript based interactive web viewer examples do not work correctly when you attempt to set them up with a data URL approach.See example file here:The "holy grail" of the FileMaker Web Viewer is interaction between the web viewer and the FileMaker application. There are plugins that can accomplish this.This file demonstrates a technique that provides limited interaction but does not require a plugin.This can be done with script-triggering plugins or with the script triggering features of FileMaker 10.Basic operation:When the user clicks or tabs into a web viewer, an objectEnter script trigger starts a timer script. The timer script looks for certain data in the URL (layout object source) of the web viewer.If the web viewer points to a simple external HTML file, then when a "method=get" type of form is submitted, the form parameters appear in the URL, like this:file:///Users/bruce/Documents/fmaction.html?firstname=Bruce&lastname=RobertsonThe timer script can look for the parameters, capture them, act on them, and reset the form.Javascript in the form can put the focus back on the form field when the script selects the web viewer.Try this in layout SimpleWebTrigger FM10. Only the last name field is evaluated, try putting in values like "a" or "w" or "roc". The portal should show matching values.PROBLEM:If you use the export CONTAINER button  to generate the external html file, everything works correctly and you get a URL as shown above. However, if you use the export TEXTFIELD button, there is a problem and the result of any form submission gets truncated, see below:file:///Users/bruce/Documents/fmaction.html?f=&l=rThis appears to be a character encoding problem and you can use a text editor such as BBEdit, TextWrangler, etc to correct the encoding of the fmaction.html file. Form submissions will then work correctly.Now if you go to layout SimpleWebTrigger FM10 DataURL, you will see that  it always fails, because of the truncated URL.So it is my suspicion that there is an encoding problem that crops up when you use the data URL method with the web viewer and attempting to create interactive applications. This file demonstrates just one of the ways this problem crops up. I have encountered many instances of this problem when trying to build interactive web viewer applications.Comments welcome. --Bruce RobertsonConcise DesignFileMaker 9 Certified