Skip Navigation

[Closed] Concatenate 4 fields when saving post

This support ticket is created 2 years, 6 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.

Our next available supporter will start replying to tickets in about 0.94 hours from now. Thank you for your understanding.

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 4 replies, has 2 voices.

Last updated by geertV-3 2 years, 5 months ago.

Assisted by: Christian Cox.

Author
Posts
#2173379

I have some textfields that I've made with Toolset.
Now I want to concatenate these 4 fields when saving the post.
How can I do that?
I'm not a programmer ;-(

Thanks

#2173575

Hello, it depends on what you want to do with this concatenated text. If you want to save the concatenated text in another custom field, it will most likely require a bit of custom programming as there is no built-in field consolidation feature in Toolset. On the other hand, if you simply want to display the fields together in a Content Template, you could use a Fields and Text block to insert the fields one by one.

So with that in mind, what exactly would you like to achieve by consolidating these custom fields?

#2175045

I have an adress field that I use for Google Maps
So in the form I have 4 fields (street, number, zip and city) and when saving the post I want that in the adress field the 4 fields will concatenate.

Thanks for your help!
Koen

#2175245
Screen Shot 2021-09-21 at 11.27.24 AM.png

Okay, I see. You'd like to concatenate some smaller address components from text fields into one complete address in an address field. Is that correct - you want the final concatenated value placed in an address field?

If so, unfortunately this is not a simple concatenation request - this is more complicated than it seems at surface level because of the features and functionality built-in to the address field. Bypassing those features leads to problems with map marker placement, views distance filtering and sorting, and distance calculation/display, so I cannot in good conscience help you set up the custom code you have asked for.

The main problem is that you are bypassing verification and validation built-in to the address field. When adding an address using an address field, the system will present similar matching address options that have been validated by the mapping API (see the screenshot here, showing several similar addresses below the input field). You must select one of those similar addresses to use as the address field value. This guarantees the address is mappable, and also sets off a series of behind-the-scenes actions that cache the address in maps cache and make it available for distance calculations, map markers, custom search views with distance filters, etc.

When you bypass this feature of selecting a verified, validated address, you end up with addresses that may or may not be mappable. They may not be formatted in a way that is understandable by Google Maps. I suggest you do not take this approach to concatenate addresses from individual components if you expect those addresses to work with maps, custom search Views with distance filters, distance calculations, etc.

#2186149

Can you please help me just to concatenate, like it is not a address field?
Thx

The topic ‘[Closed] Concatenate 4 fields when saving post’ is closed to new replies.