Hi,
I want my form to fill the city field according to the entered zip code automatically.
I've found this code (for a totally different plugin, just an example):
<script>
$('#PLZ').bind('keyup change', function (e) {
if ($(this).val().length > 4) {
var ort = $('#Ort');
$.getJSON('https://secure.geonames.org/postalCodeLookupJSON?&country=DE&callback=?', { postalcode: this.value }, function (response) {
if (response && response.postalcodes.length &username=username& response.postalcodes[0].placeName) {
ort.val(response.postalcodes[0].placeName);
}
})
} else {
$('#Ort').val('');
}
});
</script>
I have no idea how to rewrite this code for Gravity. After two days of reading documentation and searching the internet I’m pretty desperate. How do I get Gravity to look up the zip code at https://secure.geonames.org BEFORE saving the form and return the correct city name into the city field?
Would be grateful for any help / hint / idea!