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.

notifications mail with conditional messages

  1. elinet
    Member

    Hi,
    I have a problem:
    how can I make dynamic part of the text of the notification email of the user registration form?
    For example, on the notification tab i I wrote the following:

    DATI RELATIVI ALLA REGISTRAZIONE AL SITO

    Nome utente: {Nome utente:1}
    Email: {Email:43}

    DATI RELATIVI ALL'ASSOCIAZIONE

    Federata: {Federata:8}
    Estremi per il pagamento: {Federata:8:value}
    Tipo di associazione: {Tipo di associazione :60}

    SOCIO INDIVIDUALE

    Classe: {Classe:12}

    Cognome: {Cognome:13}

    Nome: {Nome:14}

    Codice Fiscale:{Codice fiscale:15}

    Partiva IVA: {Partita IVA:17}

    *SOCIO COLLETTIVO

    *Classe: {Classe:20}

    *Primo rappresentante:{Primo:52:}
    .........
    *Secondo rappresentante:{Secondo:90:}
    .........
    *Terzo rappresentante:{Terzo:89:}
    .........
    *Quarto rappresentante:{Quarto:88:}
    ..........
    *Quinto rappresentante:{Quinto:92:}
    ...............
    Comitati AICQ: {Selezione primo Comitato AICQ:110}, {Selezione secondo Comitato AICQ:111}

    I simplified the text of the message.

    What I want is that the fields marked with an asterisk are shown according to the choices of a form field, on the e-mail text a show all the fields, but it's incorrect!

    Marco

    Posted 11 years ago on Monday June 4, 2012 | Permalink
  2. David Peralty

    Sorry, you are looking to only show the ones with an asterisk if they have a value?

    If so, this isn't something easily set-up within Gravity Forms notification system and would require some customization.

    Posted 11 years ago on Monday June 4, 2012 | Permalink
  3. elinet
    Member

    True,
    i want to show only the "fields" with the asterisk, only if i select a a specific field in the form..

    Posted 11 years ago on Monday June 4, 2012 | Permalink
  4. I'm interested in something similar but it would have to do with time of day. So I'm thinking I want to send a message to clients who fill out the form during business hours that we will be with them shortly and another message to clients who fill out the form after hours that we will be in touch with them tomorrow.

    Would these types of functionality be built with a simple jquery javascript add-in or would it be more complicated than that?

    Posted 11 years ago on Wednesday June 6, 2012 | Permalink
  5. David Peralty

    corradomatt - The issue we are discussing here is notification e-mails, and not status messages on the form. You could probably implement status messages on the form with JQuery.

    elinet - There is currently no way to control this as even conditional shortcodes aren't set-up to handle this kind of situation. You would have to customize Gravity Forms beyond what I'm able to provide support with here.

    Posted 11 years ago on Wednesday June 6, 2012 | Permalink
  6. Hello,

    David indicated to Marco that it would require some customization for only displaying filled fields when you don't use the standard {all_fields} within the email body under notifications. I need to have the notification email to administrators be in a different field layout than the form. But they don't want to see empty fields when I use a format similar to Marco's above. What customization is necessary to accomplish this? Would I use the gform_pre_submission_filter hook to adjust the content of the notification to administrators? Will this affect the notification that goes to the user as well, which in my case is {all_fields}? If not this hook, another?

    Thanks.

    Posted 11 years ago on Tuesday September 18, 2012 | Permalink
  7. @uvalib, you can use the new conditional shortcodes when building your HTML notification to administrators. Read about it here: http://www.gravityhelp.com/documentation/page/Shortcodes#Conditional_Shortcode

    You could wrap your HTML in the conditional shortcode, so that if the value does not exist, there will be no bare HTML output in the notification (avoiding HTML with no value.) No need to use the gform_pre_submission filter for that.

    Because the administrator and user notifications are crafted separately, one will not affect the other.

    If you don't want to use this method, we can show you how to do it in your theme's functions.php using one of the available hooks or filters.

    Posted 11 years ago on Tuesday September 18, 2012 | Permalink
  8. What version of the plugin is required to take advantage of the shortcodes? I would love to use this method. And can these shortcodes also be used in the subject field of the admin notification? Our production environment is running 1.6.4.2.1 and I need to know if I have to ask for the update to 1.6.7. Thanks.

    Posted 11 years ago on Tuesday September 18, 2012 | Permalink
  9. The conditional shortcodes can be used in the admin and user notifications, or confirmation message. I don't believe they can be used in the subject of the admin notification. I never tried though, to be sure.

    Conditional shortcodes were added in 1.6.4

    Posted 11 years ago on Tuesday September 18, 2012 | Permalink
  10. Thanks, shortcodes worked great!
    For anyone else that reads this thread, I did test shortcodes in the notification email subject line and it does not work. But the solution for that which I have tested/works previously is to use the gform_pre_submission_filter hook:

    //Adjust the purchase request form subject line if the item is going to be purchased for a course reserve.
    add_filter("gform_pre_submission_filter_12", "change_purchase_request_form");
    function change_purchase_request_form($form){
    	// Check to see if this purchase is to be put on course reserves
    	if (isset($_POST["input_37"]) and ($_POST["input_37"] == "Yes")) {
    		// Modify the subject line if so.
    		$form["notification"]["subject"] = "Reserve Purchase Express Request";
    	}
    	return $form;
    }

    This example only modifies the subject line of the notification for the administrator.

    Posted 11 years ago on Wednesday September 19, 2012 | Permalink
  11. Thank you for the update.

    Posted 11 years ago on Wednesday September 19, 2012 | Permalink

This topic has been resolved and has been closed to new replies.