Geolocation does not work with cloned fields

Support MB Geolocation Geolocation does not work with cloned fields

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #3175
    alpha.mediaalpha.media
    Participant

    The geolocation plugin breaks when used for a cloneable group of location fields in two ways:

    • New cloned groups are not autocompleted, as the Location.init() function is only called on page load. In addition, there's no way to fix this without modifying the plugin's JS file, as the entire JS plugin is wrapped in an IIFE and thus there's no way for other JS on the page to access its scope to re-call Location.init() when a new group is added.
    • When one cloned group has an autocomplete item selected, it populates not only the fields in that group, but also the corresponding fields in every other group.
    #3178
    alpha.mediaalpha.media
    Participant

    I've figured out fixes for both issues: the first problem can be fixed by re-calling Location.init() when a new group is added, and the second problem can be fixed by making the selectors on lines 105 and 107 of mb-geo.js match ".rwmb-group-clone" as well as ".rwmb-group-wrapper", as .rwmb-group-wrapper is not present around cloned groups.

    #3181
    Anh TranAnh Tran
    Keymaster

    Thanks a lot! I will forward this to Tan Nguyen, our developer, to update the Geolocation extension.

    #3808
    Tan NguyenTan Nguyen
    Participant

    Thanks Cole, I've pushed a new release 😉

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Geolocation does not work with cloned fields’ is closed to new replies.