I'm having a problem with this code that I can't seem to figure out:
$.validator.addMethod('street_address', function (value, element) {
var address = value + ', ' + $(element).parent().parent().find("#venue_city_id option:selected").text(),
geocoder = new google.maps.Geocoder(),
that = this;
geocoder.geocode({address: address}, function (results, status) {
return that.optional(element) || status == google.maps.GeocoderStatus.OK;
});
}, 'invalid address');
It works to invalidate an incorrect address (one that is not geocodeable by Google). The problem is even when it returns true, I'm still getting 'invalid address'. Any ideas on what the problem might be?