Skip Navigation

[Resolved] Toolset form – multiple thank you messages

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 1 reply, has 2 voices.

Last updated by Minesh 1 year, 8 months ago.

Assisted by: Minesh.

Author
Posts
#2571911

Hey is there a way to add a different thank you messages based on what the user filled on the specific dropdown option?

#2572019

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Yes - it could be possible but you will have to write custom shortcode in order to build custom thank you message based on the selected option.

For example:
You can add the following custom shortcode to "Custom Code" section offered by Toolset:
=> https://toolset.com/documentation/programmer-reference/adding-custom-code/using-toolset-to-add-custom-code/#adding-custom-php-code-using-toolset


function func_show_different_thank_you_message() { 
 global $post;
 
$target_field = "book";
 $val = get_post_meta($post->ID,'wpcf-'.$target_field ,true);
 $msg = '';
 if($val == 1) {
   $msg = "Thank you for selecting the option  1";
 }else if($val == 2) {
   $msg = "Thank you for selecting the option  2";
 }
  
return $msg;
}
add_shortcode('show_thankyou_msg', 'func_show_different_thank_you_message');

Where:
- Replace $target_field with your original select field slug
- You and adjust the code as required.

And with your form's "Display a message instead of form" editor add the shortcode:

[show_thankyou_msg]