10 Replies Latest reply on Jun 13, 2017 8:40 AM by schamblee

    FileMaker 16 and Web Viewer

    germain

      Is it possible to have a simple way to post the content of a database field to a Web Viewer. I have a database with let say "Field one". I need to open a website in a web viewer that as a form and send the info from "Field one" to the form in the web viewer. I know that it's possible with some plugin out there. But I'm wondering if there a way with the new FileMaker 16 to do it without a plugin.

       

      Thanks,

      Germ

        • 1. Re: FileMaker 16 and Web Viewer
          TomHays

          It is possible to fill in a form with the WebViewer if the web page accepts the data as "GET".  This means that you can encode the field's value as a parameter value passed with the URL. (example.com/somepage.html?var=value).

           

          But I don't think the FileMaker's "POST" method (httppost) is supported for a WebViewer URL.

           

          -Tom

          • 2. Re: FileMaker 16 and Web Viewer
            monkeybreadsoftware

            You could use WebView functions in MBS FileMaker Plugin to fill the form.

            We do have Form Utility application included to figure out the field names.

            • 3. Re: FileMaker 16 and Web Viewer
              TomHays

              As a workaround you can use the Insert from URL script step to use httppost and store the response html in a field, e.g. MyURLResult

               

              Then display the contents of that field in the WebViewer via the URL

              "data:text/html," & MyTable::MyURLResult

               

              -Tom

              • 4. Re: FileMaker 16 and Web Viewer
                germain

                So how do I know if the web page accepts the data as "GET". ? And when you say you can encode the field's value as a parameter do you mean my database field "Field One"?  And do I have to name the web viewer object name?

                Germ

                 

                 

                Sent from my Bell Samsung device over Canada's largest network.

                • 5. Re: FileMaker 16 and Web Viewer
                  TomHays

                  germain wrote:

                   

                  So how do I know if the web page accepts the data as "GET".

                  If the web page is not under your control, determining if it accepts GET or POST or both is something you'd have to research.

                   

                  While the html source of the page may specify method="post" in the <form> you use to submit data, it is possible that the web page where the form is submitted will accept either GET or POST.  You could ask the site owner or just test using GET and see if it works.

                   

                   

                  And when you say you can encode the field's value as a parameter do you mean my database field "Field One"?

                   

                  Yes.

                   

                  "http://www.example.com/thePage.html?param=" & GetAsURLEncoded(MyTable::Field One)

                   

                  And do I have to name the web viewer object name?

                   

                  I think you would only need to do that if you use the "Set Web Viewer" script step.  That script step requires the Web Viewer object name.

                   

                  -Tom

                  • 6. Re: FileMaker 16 and Web Viewer
                    germain

                    Thanks all for the help and patient. I think I'm getting closer to understand. So Tom, the ""http://www.example.com/thePage.html?param=" & GetAsURLEncoded(MyTable::Field One)" is set in the web viewer settings and the GetAsURLEncoded will see the info in the Field One field and send it to the "www.example/theSpecifcPageField" is that it? I might be still a little confuse on were to put all this. A small sample file would be nice.

                     

                    Thanks

                    Germ

                    • 7. Re: FileMaker 16 and Web Viewer
                      schamblee

                      You really don't have to do anything special to pass FM data from a field to a webviewer.   The contact starter solution uses google maps which passes the address from fields to the webviewer to process and retrieve the map.  The starter solution uses a custom function but it's not required. 

                      • 8. Re: FileMaker 16 and Web Viewer
                        germain

                        Still no luck, can someone help me with step by step.

                        How to format "Field One" as calculation or just as plain text field.

                        What to put in the Web Viewer "Web Address" box.

                        Do I need a script.

                         

                        Thanks.

                        • 9. Re: FileMaker 16 and Web Viewer
                          beverly

                          You don't know. Some sites block GET, but allow POST. It's another way to prevent attacks.

                          Beverly

                          • 10. Re: FileMaker 16 and Web Viewer
                            schamblee

                            As Beverly states it cab be different for each website / api.  

                             

                            Here is a google maps sample of a calculation field. The address and google maps setting are passed from fields in the database.

                             

                            Let (
                            [
                            address = Substitute (
                            address& " " &
                            ""& " " &
                            city & " " &
                            state & " "&
                            zip & " " &
                            " " ;
                            " " ; "+"
                            ) //stores the complete address in the address variable
                            ;
                            size = GetLayoutObjectAttribute ( "Map1" ; "width" ) & "x" & GetLayoutObjectAttribute ("Map1" ; "height" )
                            ] // Set the size variable to the size of the webviewer field which is passed to the google API.  Example (300x300)
                            ;

                            "data:text/html,

                            <meta name='viewport' content='initial-scale=1, maximum-scale=1, user-scalable=no, shrink-to-fit=no' />

                            <body style='border=0;overflow:hidden'>
                            <body topmargin=0>
                            <body leftmargin=0>

                            <img src='https://maps.googleapis.com/maps/api/staticmap?" & 
                                  "&size=" & size &
                                  "&scale="& scale &
                                  "&zoom=" & zoom &
                                  "&markers=size:"&MarkerSize&"|" &
                                  "color:"&MarkerColor&"|"&
                                  "label:"&MarkerLabel&"|"&
                                  "¶"&
                                   address &
                                  "&maptype=" & MapType &"' >
                            </body>"

                            )

                            // address is set in the let statement, which combines the complete address into one variable.
                            //   zoom is passed to the google api to set the zoom level of the MapType
                            //   size is used to set the size of the map to fit the webviewer
                            //   maptype is the type of map to display.  
                            //   "" is left for other options that can be added to the url api call
                            //   most items need to be in lower cases to work with the google api