Skip Navigation

[Resolved] Remove autocomplete on Address field

This support ticket is created 3 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Author
Posts
#2075215

Don

Tell us what you are trying to do?

I know this is an odd request.... but I am looking for a way to resolve a conflict between the google autocomplete of the address field and a custom solution that i implemented to get MORE fields via autocomplete on another custom field. I still HAVE to get the full address value saved to the "default" address field so that on submit it will save that field to the correct tables, plus the corresponding lat and long for the cache table..... but as discussed in another thread i really need/want all of the location data saved separately into separate custom fields.... so I implemented a solution, that autocompletes a different custom field with google api, and immediately maps the individual address components to the other custom fields....... BUT I cannot get that new autocomplete field value to ALSO be applied to the default address field with a custom js function in the form js section:

<script type="text/javascript">
var input1 = document.getElementById('cred_form_2577_1_geo-location');
var input2 = document.getElementById('cred_form_2577_1_mapaddy');

input1.addEventListener('change', function() {
input2.value = input1.value;
});
</script>

So, i am hoping that if i know where the class for autocomplete is coded into the address field:

class="form-control toolset-google-map js-toolset-google-map js-toolset-maps-address-autocomplete wpt-form-textfield form-textfield textfield js-toolset-google-map-geocomplete-added pac-target-input"

that removing the autcomplete will leave the address field as a "normal" field that i can use for my custom solution to give it the full address value to save like usual, and still be able to get my other custom field values too... i realize this is an odd request, but any tips to point me in right direction would be much appreciated.

#2075597

Hi,

Thank you for contacting us and I'd be happy to assist.

Can you please share temporary admin login details along with the link to a page where this custom solution can be seen? I'll be in a better position to suggest the next steps accordingly.

Note: Your next reply will be private and though no changes will be made on your website, please make a complete backup copy, before sharing the access details.

In the previous ticket with Luo on this topic, I noticed you mentioned the search used in the "C&B Properties – Real Estate Site" demo website.
( ref: https://toolset.com/forums/topic/getting-and-using-individual-address-components-with-address-field/#post-2071035 )

For the State and City search, that website doesn't use the location from the address field or any other field. It uses two separate custom post types "States" and "Cities" which are joined through one-to-many relationships, so that one state can have many cities. The "Cities" post type is also connected to the "Properties" post type through a one-to-many relationship, so that one city can have many properties.

The way this arrangement works, the website's admin enters all the applicable states and their cities in the respective post types and joins them together in the correct relationship, whereas at the time of adding/posting the individual "Property" post, only the "City" needs to be specified.

So in summary, currently our general recommendation for cases where individual location components (like City, State, Postal code etc) are needed for the search filters, is to specifically/manually add them through their own custom field or post-relationship arrangement (when the certain hierarchal level connection is needed).

I hope this explanation helps.

regards,
Waqar

#2075605

Don

hello and thanks for the reply. Thanks for making sure we are on same page regarding state and city, i am aware of how the c&b theme does it, thanks to supports clarification in another thread lol, because i had originally "hoped that those fields were being saved behind the scenes on the fly from the autocompleted address field. Once that was clarified that it was NOT the case, and they were completely separate post types that must be mapped on the admin side, i completely scrapped using them, and went with my custom solution, ie using a custom autocomplete field in my form and passing the individual address components from the google api to each individual custom field in the form. This works fine..... except i cannot pass the field value from my "custom" autocomplete address field to the "built in" address field (planned to have it in form as a hidden field) because, I assume, it is also an autocomplete field.... so I had hoped that REMOVING that class from the built in address field would make it a "normal" text field in the form, which i could map a (duplicate) full address to and, on submit, it would still do what it is intended to do by default, ie save that value to the standard address field in the table and to the cache table as well..... but i would have my workaround to get all the individual address field values in my custom fields too.

#2077941

Don

My issue is resolved now. Thank you!