Validate record is within geographic area
function validateLocation() {
// The rough bounds of Colorado
var minLatitude = 36.985;
var maxLatitude = 40.979;
var minLongitude = -109.028;
var maxLongitude = -102.063;
// The latitude and longitude of the record
var lat = LATITUDE();
var lng = LONGITUDE();
if (!(lat <= maxLatitude && lat >= minLatitude && lng <= maxLongitude && lng >= minLongitude)) {
INVALID("It looks like this record isn't within the State of Colorado. Please adjust the record's location to be within Colorado.");
}
}
ON('validate-record', validateLocation);
Updated 5 months ago