-1

I try to use include in Filemaker 14 this google api Autocomplete for Addresses and Search Terms.

I use this form.

I wish to grab the datas of the sourcecode in the corrects FM fields.

But I don't find the datas in the source code.

Does anyone ever try it ? If yes with succes ;-), do you have any leads?

Thanks

Glorfindel
  • 21,988
  • 13
  • 81
  • 109

1 Answers1

0

I´m guessing you are displaying the form in a webviewer and want to extract the lookup-data into fields in FileMaker?

First of all you can´t use the GetLayoutObjectAttribute function to do this since it will only fetch the source of the webpage. It will not fetch the data currently being displayed only the HTML that was initially loaded from the http-request.

You can however add a JavaScript callback that fires when the user selects a value from the dropdown. The callback use window.location to call a FileMaker script using FileMaker URI schema and sends the data from the inputs to the filemaker-script as parameters. The filemaker script then stores them in the database.

Something like this

<script type="text/javascript">
function storeData() {

    // Set up base URI. You need to modify host-ip, database name and script name
    var uri = 'FMP://your-host-ip/databasename?script=scriptname';

    // Add form fields as parameters to the URI. These will be $variables in your filemaker script
    uri = uri + getParameter('street_number');
    uri = uri + getParameter('route');
    uri = uri + getParameter('locality');
    uri = uri + getParameter('administrative_area_level_1');
    uri = uri + getParameter('postal_code');
    uri = uri + getParameter('country');

    // Call the URI to perform FileMaker script
    window.location = uri;
}

function getParameter(name)
{
    // Return a string that can be used as a URI param
    return '&$' + name + '=' + document.getElementById(name).value;
}
</script>

You need to trigger the storeData() function using a google-api callback or some other other mechanism like a button with onClick.

You also need to add a script in FileMaker that can be called by the URI. Whatever you name that script you also need to insert into the scriptname-part of the URI. You also need to change the URI to your hosts IP or domain and the databasename where the filemaker-script is created.

In your FileMaker script the values will be availible as $variables and you can set them to fields using Set Field script step.

Hope this helps

Kalle
  • 452
  • 2
  • 4
  • 19
  • Hello Kalle ! Did you try yourself this solution ! After 2 days, i'm still stuck on it... If you have a functionning exemple it will be great ! Whithout your Api Key of course ;-) – AndyFromParis Apr 01 '16 at 13:53