7 years ago
1
Topic

Hello,

I'm using mosmap for displaying the google map. I have used the beforeRender plugin to display the map. Thats works fine. Now I want to know how I can transfer the current location (longitude and latitude) that the user entered to the map?

My beforeRender code:

$lat = $fields['latitude']->value;
$lon = $fields['longitude']->value;
$fields['test']->form = "{mosmap width='500'|height='300'|lat=$lat|lon=$lon|zoom='9'|text='Los Angeles'}";

That is working fine, but it is only loading after the first page load.

Now the user can enter a new location but the map still displayed the default location.

I have also add a JS for example to the latitude field which detects the change, but I can't transfer the current value to the map.

jQuery('#latitude').on('input', function() {
alert(document.getElementById("latitude").value);
});

How I can reload the before render plugin or how I can use the new values for displaying on the map? Any ideas? Thanks.

Get a Book for SEBLOD
4229 Posts
Kadministrator
7 years ago
0
Level 1

You can't. BeforeRender can only get values from already saved record. You could fake this by adding some javascript to trigger click on save button when user enters both required values or you could render map client side without usage of mosmap.

Get a VIP membership