1. The 3.8 code for Fabrik is now available on github, in the 'master' branch. If you are familiar with updating Fabrik from github, we would appreciate it if you could test this code on J! 3.8 for us. Once we have some feedback, we'll build a 3.8 release.

googlemap pluging Element - Change Request

Discussion in 'Professional Support' started by altnetwork, May 16, 2017.

  1. altnetwork

    altnetwork Member

    Level: Professional
    I found that if I do the following: (googlemap plug-in element)

    1. Replace the information in the , googlemap plug-in (Default location tab), [Default lat] field with the element that has the Latitude - {new_jersey_cemetery___latitude}.

    2. Replace the information in the, googlemap plug-in element (Default location tab), [Default lon] field with the element that has the Longitude - {new_jersey_cemetery___longitude}

    3. The data field for the googlemap plug-in element is set at NULL on the database

    That when saving the record the googlemap plugin element will read the information from the element {new_jersey_cemetery___latitude} and the element {new_jersey_cemetery___longitude} and record in the googlemap plug-in element in the record.

    What I am finding is that after saving the record once it will not save any changes made to the two elements, {new_jersey_cemetery___latitude} and {new_jersey_cemetery___longitude}, in the googlemap plug-in element.

    I also found that if element if blank, not NULL, it will also not save any changes.

    I found that it will only save the information to the googlemap plug-in element if the data field on the database is set to NULL.

    Changes can be still made by hand if the [Show Decimal lat/log fields] is set to yes.

    Changes requested:

    I would like to be able to make changes in the latitude, [text element], and the longitude, [text element] and if the changes update the location information in the googlemap element.

    1. Can the information on the, (googlemap Plug-in), Default location tab in the [Default lat] and [Default lon] fields be set to save the information on every save?
     
  2. troester

    troester Well-Known Member Staff Member

    Level: Standard
    Element defaults are only applied on form load if you are adding a new record. You can't use placeholders.
    On save it's saving whatever the user has set.

    I assume you are looking for geocoding:
    If you set Enable Geocode = yes you'll get a field above the map where the user can add lat/long or an address to set the marker position.
     
  3. altnetwork

    altnetwork Member

    Level: Professional
    No, users will not be entering any data. The information is being pulled by other element fields. This is what I need. Can you add setting to set the default field to do what I am looking for as an option or add a section to be able to pull the two fields for other elements as described?
     
    Last edited: May 17, 2017
  4. troester

    troester Well-Known Member Staff Member

    Level: Standard
    You can add a php form plugin and update your googlemap element on Save
    http://fabrikar.com/forums/index.php?wiki/php-form-plugin/#updating-a-form-s-value-on-save

    The format used for the Googlemap element is (lat,lon):zoom
    so something like
    Code (Text):
    $lat=$formModel->formData['tablename___your-lat'];
    $lon=$formModel->formData['tablename___your-lon'];
    $gmstring = '(' . $lat . ',' . $lon . '):10';
    $formModel->updateFormData('tablename___your-gmelement',$gmstring,true);
     
  5. altnetwork

    altnetwork Member

    Level: Professional
    Thanks, That worked!

    NOW: Can the option be added under Default Location to select [None] along with [Users location] and [Coordinates] so it will not save any default information?

    SECOND: In addition to the php form plugin, can there be a option if lat or lon are blank to not updateFormData?

    Thank You!

     
  6. troester

    troester Well-Known Member Staff Member

    Level: Standard
    Can you post what you want to achieve with the Googlemap element?

    It seems you don't need it in your form, where do you want to show/use it: in details view, in list view, in a visualisation?
    What do you expect to see if it's empty/blank/NULL/whatever?
     
  7. altnetwork

    altnetwork Member

    Level: Professional
    Sorry, Don't understand what you are asking.

    I fill out the form which is where it gets its information (lat, lon). But when it is blank I would like it to stay as NULL. I see where I can set the option for the php form not to save the information. But again, the googlemap element will post the default location. This I would like an option to not post. This way the database field will stay NULL and the record when viewed will say [No destination selected].

    How this helps explain what a I am looking for.

     
  8. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Are you actually displaying the map on the form?

    -- hugh
     
  9. altnetwork

    altnetwork Member

    Level: Professional
    Yes, I see the map when I am entering the data.

     
    Last edited: May 18, 2017
  10. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    OK, then no, we can't set the coords to "nothing". If the map is being displayed, we have to set coords for the marker, and those will get submitted with the form and recorded in the table. Modifying the plugin so the coords could be not set, and no marker displayed on the map, would require quite a lot of coding, as there are lots of places in the code where the presence of a marker is assumed, which would break if there wasn't one.

    If you are interested in funding the work, I can give you an estimate of the cost.

    -- hugh
     
  11. altnetwork

    altnetwork Member

    Level: Professional
    Then how would it work if the map did not show in the form? Can you do this?

     
  12. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Thinking about it, we can't even just display the map (in details or list views) without a location. It'll always create a marker, probably at lat/lon 0, 0 if there's no data.

    The map element is built to set and show a location, there simply is no option to not show one.



    Sent from my HTC6545LVW using Tapatalk
     
  13. altnetwork

    altnetwork Member

    Level: Professional
    Thanks for the help. I was able to create a work around for what I was looking for.

     
    cheesegrits likes this.
  14. altnetwork

    altnetwork Member

    Level: Professional
    QUESTION: What does the "Store in DB" under "Access" for the googlemaps plugin do?
     
  15. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Every element has that, controls whether the element writes data to the db or not.

    Sent from my HTC6545LVW using Tapatalk
     
  16. altnetwork

    altnetwork Member

    Level: Professional
    How is this done? I saw this on the google maps element and selected it to no save to db. But when I used the php form to save in that field it would not save.

     
  17. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Correct. If that option is selected, we don't store that element's value. You would have to write a value out by hand, in an onAfterProcess hook in the php firm plugin.

    Sent from my HTC6545LVW using Tapatalk
     

Share This Page