Skip Navigation

[Resuelto] Storing Address Components in Separate Custom Fields

This support ticket is created hace 3 años, 5 meses. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

Este tema contiene 4 respuestas, tiene 2 mensajes.

Última actualización por Dallin Chase hace 3 años, 5 meses.

Asistido por: Nigel.

Autor
Mensajes
#2097321

Hey guys,

I'm trying to use Javascript to take the separate address components from the Google Address field and store them as custom fields. For example I would be able to get the City, Postal Code, State, Country, etc.

I found this thread (https://toolset.com/forums/topic/separating-content-from-the-address-field/) and I've used the code which is working on the front end but it doesn't seem to be submitted on the backend.

Here is a video: enlace oculto

Thank you in advance.

#2097619

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

Hi Dallin

I watched your video, and see that you are doing this with a front-end form (the original thread was aimed at back-end post edit screens), and you seem to be most of the way there, inasmuch as you have populated fields in that front-end form with details from the geocoding result.

If those values don't seem to have been saved (when you check the back end) after submitting the form, it sounds like you maybe added generic fields to your front-end form rather than the custom fields themselves (you must have registered some custom fields if I can see them in the back end in the video). In that case, the generic fields would be discarded after submitting the form.

You could add some code using the cred_save_data hook (https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data) to map those generic fields onto the actual custom fields, but the simplest way would be to include the custom fields directly in the form.

Does that sound like it is the problem?

#2098311

Okay, I will try with the default fields and get back to you. Thanks.

#2098943

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

OK, let me know how you get on.

#2099379

This worked perfectly when using the right fields. Thank you.