Text Fields Missing with Place Autocomplete Address Form

Greetings.

I am using Place Autocomplete Address Form to add the province and city to a registration form in a website.

The form has a series of required fields (username, password, rewrite password, picture, city, province, country, etc.), and, as usually, a message shows up if the user fails to add some of them, or add different data in the password and rewrite password, of course.

The problem is that after any of these cases, when the form reload partially to display the message requesting for the information or to correct the errors, both the city and province fields to be filled out by the Google API are gone, completely missing. Not the content of the fields, but the fields themselves. No fields in the code, I have checked it by webmasters tools.

The user, seeing the message requesting, for instance, the picture or any other data, proceeds to add it, but those location fields down in the form are also empty, so another error message shows up.

To make things worse, each time the form displays such messages the password and rewrite password fields are empty, cos they are “password” fields, and the poor user has to start again and again.

Those fields simply are not populated by the API or the javascript behind the gadget makes them disappear for some reason.

The website is made on Joomla!, but I doubt that it is an important detail. Any other system would reproduce the same problem. I think.

I would really appreciate some expert opinion on the issue.

The js is:

function initAutocomplete() {
  autocomplete = new google.maps.places.Autocomplete(
  (document.getElementById("form_field_46")),
      {types: ['geocode']});
  autocomplete = new google.maps.places.Autocomplete(
  (document.getElementById("form_field_55")),
      {types: ['geocode']});
}
function fillInAddress() {
  var place = autocomplete.getPlace();
  for (var component in componentForm) {
    document.getElementById(component).value = '';
    document.getElementById(component).disabled = false;
  }
  for (var i = 0; i < place.address_components.length; i++) {
    var addressType = place.address_components[i].types[0];
    if (componentForm[addressType]) {
      var val = place.address_components[i][componentForm[addressType]];
      document.getElementById(addressType).value = val;
    }
  }
}

Where form_field_46 and form_field_55 are the ids of the city and province fields.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.