Tommy B
Posts: 0
Joined: Sat Sep 15, 2012 3:39 am

Get geolocation from label info

I am building an app that stores the latitude and longitude when a record is saved. What i am trying to do with no sucess is show the location on a map with the user views the record. I get the alert text saying that it did not find it.

I have the Lat and Long displayed in hidden labels and I am using the following javascript on a button click on the screen.

var latlocation = Tiggr ('latDataView');
var longlocation = Tiggr ('longDataView');
if (latlocation.val() == ' ') {
alert ('Did not find Latitude in database.');
return;
}
if (longlocation.val() == ' ') {
alert ('Did not find Longitude in database.');
return;
}
var map = Tiggr('_viewgeolocation');
map.options['latitude'] = latlocation.val();
map.options['longitude'] = longlocation.val();
map.refresh();

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Get geolocation from label info

You first need to make sure that Tiggzi('latDataView').val() returns the correct value. What type of component latDataView is?

Tommy B
Posts: 0
Joined: Sat Sep 15, 2012 3:39 am

Get geolocation from label info

('latDataView') is a label that is populated from a tiggzi db. How it gets populated is from a clickable list that sets a local var and then navigates to a "view only" style screen. When the screen opens it picks up the local var and pulls the corresponding data from the db and populates a set of label's.

Kind of like a "report view"

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Get geolocation from label info

Ah.. when you you the Label component, it has to .text() function:

code
Tiggzi('id').text();
/code

It just how jQuery works. Only Input has .val();

Return to “Issues”