updating calc element on form when 'geocomplete' field is changed

skyrun

Active Member
i have an 'address' field where the user can type their address, then i have a calc field where i would like to use the value selected (or value typed if no address is selected by user) as input.

i set a javascript (on change) for the address field, but the value of $('mytable___address').value seems to be what is typed by the user, not what is selected from the google place id lookup.

for example, if i type 655 and select '6555 Federal Boulevard, Denver, CO, USA' from the google dropdown list, the js variable $('mytable__address').value is '655' (not the selected address).

perhaps similar to http://fabrikar.com/forums/index.ph...lc-element-using-the-google-map-marker.46922/ but triggering for the geolocation selection.
 
I presume you are talking about the 'geocomplete' feature of a field element?

I have no idea when the 'change' event would fire for that, I suspect it may be before the geocomplete does it's work.

Try listening for fabrik.element.field.geocode in your own form_X.js ...

Code:
requirejs(['fab/fabrik'], function () {
   Fabrik.addEvent('fabrik.element.field.geocode', function (el, result) {
      // element object is in 'el', places lookup result is in 'result'
   });
});

That event should get fired whenever the user selects a result from a geocomplete.

Note entirely sure if it gets fired if they dismiss the menu without choosing, but you could probably handle that with something else, like a blur.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top