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.

Where does the form action go?

  1. I have a very simple form from an old site we are converting to WordPress. The form only asks for an email address and displays a Sign Up button.

    I cannot figure out where to add the form action. Where in the heck does it go?

    If I knew where to put it this is the string I would add this:
    "http://app.streamsend.com/public/SDBo/V8c/subscribe"

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

    All forms go to Gravity Forms. You can't change the form action in a Gravity Forms form. You can use gform_after_submission to push data to third party services. http://www.gravityhelp.com/documentation/page/Gform_after_submission

    Posted 10 years ago on Wednesday May 29, 2013 | Permalink
  3. Thanks David.

    I think that the second line, below, is edited correctly because the form I want to use has an ID of 2.

    If I only have an email address in my form to send to a third party service I would add this to the functions.php as shown below. I'm only guessing because I don't know how to determine the value I found in the braces example: [1] or the name of the email field (I don't see anywhere in the form that tells me that). Even if I'm right about where to put the path I don't know what to do in the array. I probably don't need the array part since it is one value but lets not worry about that.

    I would also like to know what the 10 and 2 stand for in the second line of the code below.

    I feel like I'm close to the proper solution I hope you can help. Thanks.

    ?php
    add_action('gform_after_submission_2', 'post_to_third_party', 10, 2);
    function post_to_third_party($entry, $form) {
    
        $post_url = 'http://app.streamsend.com/public/SDBo/V8c/subscribe';
        $body = array(
            'email' => $entry['1']
            );
    
        $request = new WP_Http();
        $response = $request->post($post_url, array('body' => $body));
    
    }
    ?>
    Posted 10 years ago on Wednesday May 29, 2013 | Permalink
  4. I do hope you see the question in my reply above. I really want to understand the script to work with my form.

    Posted 10 years ago on Thursday May 30, 2013 | Permalink