I have the need to search a directory of service providers. In the directory I have the lat/long of each provider in two fields (geo_lat, geo_long). I have another table that is "cities". In there, the center of each city is also coded with geo_lat and geo_long. I want to have a user be able to type in the name of a city and have it lookup the geo_lat and geo_long of that city and use them in a radius search of the service provider directory.
I cannot use addresses or zip codes because we are a confidential hotline that does not collect that type of information for safety purposes. I can do the lookup of the city and find the lat/long values, but I don't know how to pass them to the Distance Search Center Lat and Center Long fields. Suggestions?
In my searching around I thought that by using this snippet of code in an HTML block it might work. The idea is that the Virtual4 field is populated with the latitude of the city and the Virtual5 field is populated with the longitude of the city. I am then trying to set the value of the 2 distance search fields (cbDSField1 and cbDSField2) to those two values. I am using the onchage trigger instead of on-submit in the hopes I would be able to see the values populate in all four fields. It just isn't working. What am I doing wrong???
<SCRIPT LANGUAGE="JavaScript">
<script>
function searchGeo()
{
let search_lat = document.getElementByID('cbParamVirtual4').value;
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
mhand
Hello,
I have the need to search a directory of service providers. In the directory I have the lat/long of each provider in two fields (geo_lat, geo_long). I have another table that is "cities". In there, the center of each city is also coded with geo_lat and geo_long. I want to have a user be able to type in the name of a city and have it lookup the geo_lat and geo_long of that city and use them in a radius search of the service provider directory.
I cannot use addresses or zip codes because we are a confidential hotline that does not collect that type of information for safety purposes. I can do the lookup of the city and find the lat/long values, but I don't know how to pass them to the Distance Search Center Lat and Center Long fields. Suggestions?
In my searching around I thought that by using this snippet of code in an HTML block it might work. The idea is that the Virtual4 field is populated with the latitude of the city and the Virtual5 field is populated with the longitude of the city. I am then trying to set the value of the 2 distance search fields (cbDSField1 and cbDSField2) to those two values. I am using the onchage trigger instead of on-submit in the hopes I would be able to see the values populate in all four fields. It just isn't working. What am I doing wrong???
<SCRIPT LANGUAGE="JavaScript">
<script>
function searchGeo()
{
let search_lat = document.getElementByID('cbParamVirtual4').value;
document.getElementByID('InsertRecordcbDSField1').value = search_lat;
let search_long = document.getElementByID('cbParamVirtual5').value;
document.getElementByID('InsertRecordcbDSField2').value = search_long;
}
document.getElementById('caspioform').onchange = searchGeo;
</script>
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.