PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Need to stop notfications from sending if criteria is not met

  1. I have looked through the forums and have not seen a way to do what I want.

    What I want is simple. I wanted all forms to submit successfully but if the sum of two of the fields is not equal to a given amount then I want the notification to be canceled.

    Example:
    If field 1 = 5 and field 2 = 5, the sum of those two fields is 10. Send the notification
    If field 1 = 4 and field 2 = 7, the sum of those two fields is 11. Send the notification.
    If field 1 = 4 and field 2 = 4, the sum of those two fields is less than 10. Don't send the notification.

    Posted 10 years ago on Thursday May 2, 2013 | Permalink
  2. David Peralty

    We don't have a way with conditional notifications to check the sum of two fields, so you would have to do the math in a gform_pre_submission hook and throw the value into a hidden field, and then use that value as your comparison.

    Posted 10 years ago on Friday May 3, 2013 | Permalink
  3. yeah I figured it out actually but I didn't do it that way.

    This is what I did:
    'function before_email($email){
    //cancel sending emails
    //print_r($_POST);
    if ($_POST[gform_submit] == 1) {
    $totalreach = $_POST['input_29'] + $_POST['input_30'];
    if ($totalreach >= 10000) {
    $email["abort_email"] = false;
    }
    else {
    $email["abort_email"] = true;
    }
    }
    return $email;
    }'

    Posted 10 years ago on Friday May 3, 2013 | Permalink
  4. David Peralty

    Glad you got it sorted. All my best!

    Posted 10 years ago on Friday May 3, 2013 | Permalink