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.

best way to show "please wait" message after submission waiting for redirect

  1. equalizer
    Member

    I am using the form to redirect after submission, and I am using the post submission hook to echo out a message to tell the user not to reload the page and to be patient (in case the redirect takes several seconds).

    However, as expected, this makes it output that on all my forms. So I used a simple if statement to see if one of the required fields was filled in, and this fixes it.

    The problem is, the inputs are named generically, so any form with the same input_# would trigger it. What is a more reliable way of filtering which form was submitted when using the post_submission hook?

    Posted 14 years ago on Monday November 8, 2010 | Permalink
  2. You should be able to use inheritance from the unique form ID like "#gform_wrapper_8 #input_8_43". Have you tried that?

    Posted 14 years ago on Monday November 8, 2010 | Permalink
  3. equalizer
    Member

    Is there a way to get the name of the form though in PHP? I thought it only received the names of the fields. Hopefully I am wrong?

    Other ways I've thought of are:

    1) to add a hidden input to the form i want to trigger the message, and check for a specific value that is unlikely to coincide with any real input on any form with the same input field name;

    2) to check the URL the request is coming from (not sure this will work with the way Wordpress works overall though)

    I guess #1 is pretty straightforward and that's probably what I'll implement in the future, unless there is in fact a way to get the name of the submitting form in PHP. I haven't been able to find a way to do that.

    Posted 14 years ago on Tuesday November 9, 2010 | Permalink
  4. You should use the $form["id"] variable that is passed to the gform_post_submission hook. See code snippet below:

    add_action("gform_post_submission", "gf_submission_hook", 10, 2);
    function gf_submission_hook($entry, $form){
           if($form["id"] == 10){
                 //add code for form 10
           }
    }
    Posted 14 years ago on Tuesday November 9, 2010 | Permalink