Forum Discussion
_anomDiebolt_
7 years agoQrew Elite
I thought I would add a dead simple and extremely useful example to contrast the IOL technique with the new 3Q&S technique. This example actually arose out of a client's request to add geoLocation to the form their field technicians create.
First just visit each of these URLs and you will be prompted to share your current location (don't save the record unless you want to share your latitude and longitude):
Locations 1 ~ Add New Record ~ Using IOL Technique
https://haversineconsulting.quickbase.com/db/bn77i2rxe?a=nwr
Locations 2 ~ Add New Record ~ Using 3Q&S Technique
https://haversineconsulting.quickbase.com/db/bn78s62hp?a=nwr
Each of the screens look like this and your Latitude and Longitude will be filled in automatically (after your give your permission):
The traditional IOL technique requires a little setup for the (1) formula, (2) user defined variables, and (3) code page. Here is the formula and code page used in this table:
Now lets look at second table where the 3Q&S technique is used.
Here is the field definition for for the Rich Text Formula field [-]:
I hope that helps understand the difference between the IOL and 3Q&S.
First just visit each of these URLs and you will be prompted to share your current location (don't save the record unless you want to share your latitude and longitude):
Locations 1 ~ Add New Record ~ Using IOL Technique
https://haversineconsulting.quickbase.com/db/bn77i2rxe?a=nwr
Locations 2 ~ Add New Record ~ Using 3Q&S Technique
https://haversineconsulting.quickbase.com/db/bn78s62hp?a=nwr
Each of the screens look like this and your Latitude and Longitude will be filled in automatically (after your give your permission):
The traditional IOL technique requires a little setup for the (1) formula, (2) user defined variables, and (3) code page. Here is the formula and code page used in this table:
[-] field definition:The purpose of the setting the "readonly" attribute is prevent a human from modifying the latitude and longitude directly as these fields will automatically have their values set by script. Note that the script uses double quotes. Additionally, note that if you were to copy an application that used the IOL technique you would normally have to modify some hard-coded dbid's (but not in this particular case) and perhaps some other parameters in the script. In general applications that use the IOL technique have to have a little maintenance on the module.js code page if they are to be copied.
[iol] & "module.js" & [/iol]
module.js code page:
$("#_fid_7").attr("readonly", true);
$("#_fid_8").attr("readonly", true);
navigator.geolocation.getCurrentPosition(pos => {
_fid_7.value = pos.coords.latitude;
_fid_8.value = pos.coords.longitude;
});
Now lets look at second table where the 3Q&S technique is used.
Here is the field definition for for the Rich Text Formula field [-]:
[-] field definition:Note we are now using backticks quotes instead of double quotes and the JavaScript code is otherwise identical and still readable. As a bonus this implementation of the geoLocation feature is portable.
"<img src onerror='
$('#_fid_7').attr('readonly', true);
$('#_fid_8').attr('readonly', true);
navigator.geolocation.getCurrentPosition(pos => {
_fid_7.value=pos.coords.latitude;
_fid_8.value=pos.coords.longitude;
});
'>"
I hope that helps understand the difference between the IOL and 3Q&S.