Recover distance with Google Map API - Thread 2017

Maud67

New Member
Hi,

I followed the Thread from 2017.
http://fabrikar.com/forums/index.php?threads/recover-distance-with-google-map-api.46506/

I get all needed distance data (status "OK") when I execute var_dump:

// test ... comment this out once you have the right URL and are getting sane JSON
var_dump($distanceResult); exit;

// if result OK, grab the 'value' from the first row's first element data and stuff it into your distance element
if ($distanceResult->status === 'OK') {
// get the first row, by using the array helper to get index 0, with an empty array as default
$firstRow = FArrayHelper::getValue($distanceResult->rows, 0, array());
// check to see if the result is empty
if (!empty($firstRow)) {
// if we got the first row, get the first element from it
$firstElement = FArrayHelper::getValue($firstRow, 0);
if (!empty($firstElement)) {
// if we got the element, get the distance
$formModel->setFormData('x_google___distance', $firstElement->distance->value);
}
}
}

But... somehow it will not write the data to my "distance" element.
PHP form plugin onBeforeProcess

Can somebody help me with this please?
Thanks a lot!
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top