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.

Get customfield value and send it as e-mail recipient

  1. peter
    Member

    i guess this has been asked a million times but i dont get it

    the problem,
    i've got about 90 pages filled with all sorts of custom fields
    some sort of membership directory
    and one of those customfields is called "vl_email"

    how do i get it to send to the routing system
    i need to get it to the routing system because the are also some other emailaddresses the form has to go to based on choices he/she makes...

    please help!

    Posted 13 years ago on Wednesday March 23, 2011 | Permalink
  2. I'm not 100% sure what you are asking. Are you wanting to populate a form email field with a value stored in a custom field?

    Posted 13 years ago on Wednesday March 23, 2011 | Permalink
  3. peter
    Member

    yep in the routing system

    Posted 13 years ago on Wednesday March 23, 2011 | Permalink
  4. In the routing system. That is more difficult. I'm not sure if there is a way to do that with routing. BUT you can write code to dynamically set the Send To address of the Admin Notification. So while you can't do this with the Routing feature, you can do it with custom code.

    Here is the documentation for the gform_notification_email hook:

    http://www.gravityhelp.com/documentation/page/Gform_notification_email

    You would have to write custom code you place in your themes functions.php file that would use this hook to dynamically populate the admin notification send to email.

    Posted 13 years ago on Wednesday March 23, 2011 | Permalink
  5. peter
    Member

    i tried to do so, but i cant get this solutions to work i've tried

    add_filter("gform_notification_email_2", "change_notification_email", 10, 2);
    function change_notification_email($email, $form){
       return "<?php meta('vl_email'); ?>";
    }
    Posted 13 years ago on Wednesday March 23, 2011 | Permalink
  6. Hi Peter,

    Give this a shot (make sure to update the code as specified in the inline comments):

    [php]
    <?php
    
    // update the '2' to the ID of your form
    add_filter("gform_notification_email_2", "change_notification_email", 10, 2);
    function change_notification_email($email, $form){
    
        // update the '1' to the ID of your field
        $email = $_POST['input_1'];
    
        return $email;
    }
    Posted 13 years ago on Wednesday March 23, 2011 | Permalink
  7. peter
    Member

    silly question i guess

    what is the id of the email field on this page http://www.ves.nl/max

    Posted 13 years ago on Wednesday March 23, 2011 | Permalink
  8. @peter The field id is 9. Here is a screenshot of the HTML for the input. The name attribute contains the field id. http://grab.by/9EWu

    Posted 13 years ago on Thursday March 24, 2011 | Permalink