Skip Navigation

[Resolved] Require User to choose an autosuggested address

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to require Users to select one of the autosuggested options for an Address field. If Google cannot find the address, the User should not be able to submit the address.

Solution: There's no built-in way to require selection of one of the suggestions supplied in the autosuggest field. In theory you could use the CRED API cred_form_validate to perform custom validation on the backend using the Google Maps APIs, and return an error to the User if necessary.

Relevant Documentation:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_validate

This support ticket is created 6 years, 10 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by cristianP-3 6 years, 10 months ago.

Assisted by: Christian Cox.

Author
Posts
#620602

Tell us what you are trying to do?
When you write an address into the custom field address of toolset map, google maps autosuggest addresses with a dropdown menu. But you can use also you writed address without choose one of the addresses suggested.
I want to force the user to use one of the suggested address so I'm sure to obtain from google with an api call all the information about nation, city and so on.

Is there any documentation that you are following?
toolset documentation and google map documentation

Is there a similar example that we can see?
nope

What is the link to your site?
musicamea.com but now it's still in develop mode

#620671

Hi, there's no built-in way to require selection of one of the suggestions supplied in the autosuggest field. In theory you could use the CRED API cred_form_validate to perform custom validation on the backend using the Google Maps APIs, and return an error to the User if necessary. We have more information about CRED's form validation API here:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_validate

#624995

Thank you!