Skip Navigation

[Resolved] Contact form with pick closest / preferred office based on address

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 5 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

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/Hong_Kong (GMT+08:00)

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 5 years, 10 months ago.

Assisted by: Luo Yang.

Author
Posts
#654781

Tell us what you are trying to do?
I'm trying to create a contact form that has an option to add your address then it shows your 3 closest offices from which you can select your preferred location. Then send the form to that office's email address.

So the form would have the simple fields
name
email
phone
Prefered date ( basic calendar selector )
What type of client are you (checkbox selector to show personal or business)
Services required based on type of client ( checkbox selection of services, this section hidden options based on selections )

Find your local office / Enter your suburb, region or postcode (as you type I'd like to show the options available to the client and they select the office they prefer. This can be an auto filling field using Relevanssi I guess or show results and you click to select... This part is where I'm unsure if its possible )

SUBMIT - Sends the form to the office selected above

Is there any documentation that you are following?
I've only been watching the video tutorials available on youtube and via the backend and can't work out if this is possible with the base plugins and some configuration or if it will need some custom code to achieve the desired result

Is there a similar example that we can see?
To be 100% honest I've not found an exact example of the form I'm trying to achieve. If we could see a list of the local offices based on the address then as it auto fills the

What is the link to your site?
That is the current domain I'm working on but it's not the final location for this solution. I just wanted to work offline prior to doing it on the actual site that is much larger
hidden link

Initially, I'd just like to know if this is possible without a developers support or if I'll need some custom code.

Hope that make sense and thanks for your time

#654952

Hello,

There isn't such a built-in feature within Toolset plugins, and you are right, it needs custom code works, here is my suggestion.

When user submit the CRED form, use CRED filter hook "cred_notification_recipients" to trigger a PHP function, in this function:
1) get the address field value submitted by user
2) find those three office posts, get the email address from those office posts
3) change the notification recipients to above email address values

More help:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_notification_recipients
This filter allows you to add or modify email recipients of CRED notifications

The forum ‘Types Community Support’ is closed to new topics and replies.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.