I am also trying to get this to work for a Windows tablet.
I have done a little research and discovered that Internet Explorer (which is used by FMP on Windows) limits the length of URLs to 2,083 characters.
The base64 encoded signature that the Web Viewer is trying to send back in to FMP is around 18,000+ characters.
Safari allows URLs up to 80,000 characters.
This is why it works on Mac but not Windows – which is a pain to say the least.
From This ¶ // Prep the URL to use for the hand-off to FM.
¶ var fullURL = '" & fmpurl & "¶m=' + var_encoded;
To This ¶ // Prep the URL to use for the hand-off to FM.
¶ var fullURL = '" & fmpurl & "¶m=' +'hello';
... in order to test my hypothesis, which turned out to be correct. It ran the script and displayed some ??? in my container field. Whereas before it wouldn't even run the script.
But unfortunately, I haven't come up with a solution.
I've found a workaround!
It does use the clipboard though, but I've found no other way.
¶ // Send the data to the Clipboard.
¶ window.clipboardData.setData( 'Text' , var_encoded );
¶ // Prep the URL to use for the hand-off to FM.
¶ var fullURL = '" & fmpurl & "¶m=clipboard';
This will send the Base64 encoded text to the windows clipboard.
Then fire off the 'save signature' script using the parameter "clipboard"
In the FMP script you can add an if script parameter = clipboard step then paste the clipboard contents to another field. I created another text field called SigBase64. You can then set the Signature container to the Decoded contents of the SigBase64 field; I needed to add a few more Substitutions to the pasted data, before i could decode it:
TABLE::SigBase64 ; [ "data:image/png;base64," ; "" ] ;
[ "%2B" ; "+" ] ;
[ "%2C" ; "," ] ;
[ "%2F" ; "/" ] ;
[ "%3A" ; ":" ] ;
[ "%3B" ; ";" ] ;
[ "%3D" ; "=" ]
The new SigBase64 field needs to be on the layout you are pasting it into; but I hid mine, because I don't want the end users to see it.
Hope this helps people!
I had found the information about the limits on Internet Explorer, and I assumed that may be the issue. I will give it a test today. Thanks.
I got this working with Phil_1986 information he provided above. I made some other small changes to make it easier to distribute this modified version. Users that are interest in this file, please download the original from http://www.fmeasysignature.com/ which has the login information plus license agreement.
The modified file can be download here :
This new file will work on mac & windows.
Thanks again Phil_1986
I use this solution on transformer book Asus with Win8 and works correctly.
After that I install this solution on another same model fo transformer book with identically configuration. But It doesn't work.
Is possible draw the signature and cancel button works, but the save button doesn't "export" signature in to Container field.
When I save, the clipboard is populate with var_encoded.
There is a particular setting of the browser to check?
The solution uses fmpurl. I have seen issue if you have more than one copy of FM installed on the system (13 & 14) and you are running the database from the older version 13. I've tried to set 13 as the default program to open the database but it still does not seem to work. So if you have more than one version of FM you will need to use the newest version or uninstall the newest version.
fmpurl is used in the custom function, I understand that the database filename is case sensitive. This is the step that sends control back to FM so this is where I would start my trouble shooting.
Is this solution holding up well on windows 10 or are you using another method now? Thanks for sharing the file!
I'm not being able to access the file....any other way you could post it? Thanks for the help.