I use a before submit hook in order to run some javascript before the submit. Therefore I use the following code:
jQuery(function() {
jQuery('#setup-form').submit(function(e) {
codeAddress();
return true;
});
});
The function codeAddress()
fills two hidden input fields with data. The data is actually filled (into the value attribute). But on the server's side there is no data arriving. What is the problem here?
FYI:
function codeAddress() {
var address = document.getElementById('address').value;
if(address){
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var location = results[0].geometry.location;
var location2 = '' + location;
location2 = location2.slice(1, location2.length - 1).split(', ');
jQuery('#geo-lat').attr('value', location2[0]);
jQuery('#geo-long').attr('value', location2[1]);
map.setCenter(location);
var marker = new google.maps.Marker({
map: map,
position: location
});
} else {
alert('Geocode was not successful for the following reason: ' + status);
}
});
}
}