Skip Navigation

[Resolved] Field conditions on Notification e-mail trigger not working properly

This support ticket is created 4 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 7 replies, has 2 voices.

Last updated by Christian Cox 2 years, 9 months ago.

Assisted by: Christian Cox.

Author
Posts
#1246565
Form266-answers.jpg

Hello, I am developing a Quiz, a form with 3 questions.
Each question has 3 radio boxes with answers.
I want to send 2 different mail notification, one to congratulate if the responses are correct, the other if the answer(s) are wrong. For this scope i am using Toolset notification email with fields conditions but if answers are OK both messages are sent out.

Im my form id 266, the right answers are:
Q1: answer id=3
Q2: answer id=1
Q3: answer id=3

See in the attached screenshot of the notification setting used to trig the notification.

As already said, if the answers are ok both notifications are sent out, while if responses are wrong only the notification for bad answers is sent. (i have the same issue on other forms)

I also use this code (in function.php) that it works well to redirect the user after the form submission :

if ($form_data['id']==266){
	 if($_POST['wpcf-recharge-horodateur'] == 3 && $_POST['wpcf-macaron-multizones'] == 1  && $_POST['wpcf-partager-macaron-collegue'] == 3) 
		    {
		         $url ="/bravo";       //  good answers
		    }   else 
		    {
		         $url = '/dommage';    //  bad answers
		    }    
		} ;

The redirection works just fine, if the answer is correct (3 - 1 - 3) the user is redirected on the corresponding page.

Thanks for your assistance

#1246632

Hi, I'm asking my 2nd tier team to take a look at notifications triggered using this "<>" condition, because they don't seem to be working as expected. As a temporary workaround, could you test using the combined positive conditions instead, like instead of <> 3, test for = 1 or = 2, for each field?

#1246785

Hi Christian,
your suggestion to use positive conditions is working, for now i can live with but on the long run i would prefer to have it fixed; my next form will include 5 questions x 3 answers and that will implies positive evaluation of 15 values, a bit annoying 🙂

Any idea how long it will take the correction ?

#1246787

I haven't heard final word from my 2nd tier team, so I can't really say for sure now. Assuming it is a bug, it could take multiple weeks to solve.

#1256261

Our developers have published an erratum post about this issue here: https://toolset.com/errata/forms-notifications-always-sent-when-its-condition-depends-on-a-radio-field/

You can subscribe there to receive updates as work progresses.

#1264409

Hi Christian,

thank you for helping with previous issue, i can wait until it will be fixed.

Meanwhile i got a new issue: suddenly the form redirection does not redirect anymore; same form, same id same code... it was working with no issues until few days ago, now i am worried since the site is in production !

In function.php

//======================================================================
// GET  SUBMIT FORM EVENT AND REDIRECT CONSEQUENTLY
//======================================================================

add_filter('cred_success_redirect', 'custom_redirect',10,3);
function custom_redirect($url, $post_id, $form_data) {
	
	//  Jeu Parking Form 1
     if ($form_data['id']==82){
	       
	     //  if($form_data['form_id']==82){
		    if($_POST['wpcf-q1-annee'] == 2 && $_POST['wpcf-q2-recharge'] == 3  && $_POST['wpcf-q3-placesvelo'] == 3) 
		    {
		         $url ="<em><u>hidden link</u></em>";
		    }   else 
		    {
		         $url = '<em><u>hidden link</u></em>';
		    }    
            
            
		} ;
		
  return $url ;


};

#1264655

I found the trick... it seems that in Settings in
CRED > your_form > Edit > Settings > After visitors submit this form
it is not enough saying "Go to a page" but it is necessary to assign a whatever page, then the redirection script in function.php will works.
If it is on "Go to page" but no page is assigned then the script will not evaluate on form submission... strange!

#2088519

FYI our developers have informed me the issue regarding field conditions for Forms notification triggers will be fixed in the upcoming Forms 2.6.10 release.

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