Essentially, you want to say "if there are any Yes answers, send one notification, otherwise send another one (the one for all NO responses)." Is that correct?
It will look something like this:
[php]
<?php
// change the 34 here to your form ID
add_filter('gform_pre_submission_filter_34', 'conditional_message');
function conditional_message($form){
// here you will need to determine if any radio buttons were selected "yes"
// $yes should be set to the total number of YES answers, i.e. radio buttons marked yes
// you will read the $_POST array and check to see if any radio button was chosen "Yes"
/// this is dependent on your form and its fields
$yes = 1; // set $yes to any number here to test the logic below
if($yes = 0) {
$form['autoResponder']['message'] = "This is the default message (meaning, everything was answered NO.";
}
else {
$form['autoResponder']['message'] = "This is the message you receive if you answered yes to any question.";
}
// return modified form
return $form;
}
The logic in lines 5-9 is highly dependent on your form. Go ahead and build the form and then we'll see what the best way is to see if any radio button was marked "Yes".
Posted 12 years ago on Wednesday November 21, 2012 |
Permalink