Map Default Location. Drowning off the coast of Nigeria(Solved)

nobicycle

New Member
Greetings,

I have a multi-page form. On page 1 is city. City has an associated special point (lat/long) in a city table.
On page 2 is a map element that I would like to display a marker for the special point.

There are a couple of nice threads on this subject:
http://fabrikar.com/forums/index.ph...long-and-zoom-default-fields-of-google.22533/
and here
http://fabrikar.com/forums/index.ph...or-googlemap-on-detail-view.14630/#post-86301

But I still can't see how to set the map default location before page 2 is rendered.

Incidentally, I tried using the "Users Location" option for the default, but it kept putting me in the ocean off West Africa:) Maybe that is a quirk of the fact that I was using tor to spoof my IP as being in the UK. The browser did indicate I was in London (myip.com) but the map put me in the water.:) There were also funny values for the Default lat (53.2224)
and Default lon (-4.2007) fields and I could not get rid of them. After delete, save, close, they were still their when I opened the element again.

But back to the question, how can I get the Page 2 map to use display a marker for the city special point from page 1?
 
I assume you are drowing at 0?00'00.0"N 0?00'00.0"E in the Gulf of Guinea;)

The googlemap element needs coords in format (lat,lon):zoomfactor, e.g.
(45.8,7.9):4
so you have to convert you city coords into this format
 
I assume you are drowing at 0?00'00.0"N 0?00'00.0"E in the Gulf of Guinea;)

The googlemap element needs coords in format (lat,lon):zoomfactor, e.g.
(45.8,7.9):4
so you have to convert you city coords into this format


Sorry, I didn't explain well. The Googlemap element on page 2 is already pointing at a google format point field, but I want the default to be drawn from the city table when users create a new record.
 
*sigh*

Nobody ever uses the default value for the map element, which is set to Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch in Wales. I set it to that just because a) it has to default to somewhere and b) I just want one person, one day, to set up a map element and say "Hey! That's where I live!".

Anyway ... assuming the city doesn't get selected till the user is filling out the form, you'll have to use some custom JS for this.

You said it's a join. Which I presume means the value is set to the PK of the city table, which doesn't get us the lat/lon. Is the lat/lon of the city available anywhere, like in the label of the city?

If not, you'll probably need to use a user_ajax.php and an AJAX call in a custom JS script, triggered by a 'change' on the city join element, which returns the lat/lon of the city, which you can then use to update the map element with.

-- hugh
 
*sigh*

Nobody ever uses the default value for the map element, which is set to Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch in Wales. I set it to that just because a) it has to default to somewhere and b) I just want one person, one day, to set up a map element and say "Hey! That's where I live!".

Anyway ... assuming the city doesn't get selected till the user is filling out the form, you'll have to use some custom JS for this.

You said it's a join. Which I presume means the value is set to the PK of the city table, which doesn't get us the lat/lon. Is the lat/lon of the city available anywhere, like in the label of the city?

If not, you'll probably need to use a user_ajax.php and an AJAX call in a custom JS script, triggered by a 'change' on the city join element, which returns the lat/lon of the city, which you can then use to update the map element with.

-- hugh
Thank you very much Hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top