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.

Posting information to a form

  1. I need to send information to a contact form, for instance, the unique id of a particular location, and from that information I need the form to send its notification to a different email based upon the unique id.

    So, for 200 unique id's we could see 200 different email address that are available to have a notification email sent to. I also need to send the form to multiple people...

    Posted 14 years ago on Wednesday January 6, 2010 | Permalink
  2. You may want to look at this thread:

    http://forum.gravityhelp.com/topic/sending-form-to-author-of-post

    This user shows code samples of how he used the API hooks to populate a field AND dynamically tell the notification email where it should go.

    You will want to do something similar only instead of populating the subject field you could populate a hidden field that is for the location id. Then based on the location id you can set the notification email to go wherever you want.

    You need to be familiar with PHP and how to use WordPress hooks to do this, look it over and if you need additional help we may be able to come up with a code snippet for you.

    Posted 14 years ago on Wednesday January 6, 2010 | Permalink
  3. clevyr,
    Following is a code snippet that you can try. Place it in your theme's function.php. You will need to replace the form id in the add_filter call with your form id (i.e. 18 in gform_notification_email_18).

    add_filter( 'gform_notification_email_18', 'route_notification', 10, 2 );
    function route_notification($email_to, $entry) {
    
        //1- Read location id from query string parameter "location_id"
        $location_id = $_GET["location_id"];
    
        //2- Create a key/value array with the location id (key) and the emails that will be sent (value).
        //To send to multiple people, simply separate multiple emails with a comma (,)
        $emails = array("1" => "email_1@test.com",
                        "2" => "email_2@test.com, email_2b@test.com",
                        "22" => "email_22@test.com"
                        );
    
        //3- Lookup the array above to find which email(s) the notification need to be sent to.
        $email_to = $emails[$location_id];
    
        //4- Return the email(s) so that they are used for the notification
        return $email_to;
    }
    Posted 14 years ago on Thursday January 7, 2010 | Permalink
  4. Awesome, trying this tonight.

    Posted 14 years ago on Monday January 11, 2010 | Permalink
  5. Dont suppose you can tell me why the form loses its CSS when posted into one page vs another?

    Posted 14 years ago on Monday January 11, 2010 | Permalink
  6. I'm not aware of anything offhand that would cause the difference. Could you share a couple of links to the forms? I'll be happy to take a look at it and see what we can figure out.

    Posted 14 years ago on Monday January 11, 2010 | Permalink