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.

Question regarding presubmission handler

  1. Hi there

    What are the conditions that would cause the <i>gform_pre_submission</i> to not be called?

    I have this hook which takes the entries of a form to generate a PDF. Once the PDF is generated, it will add the link to the PDF in a hidden field. The email with the PDF is then sent to both the admin and the user.

    The weird problem I'm having now is that it works fine, but for a few users, the PDF isn't generated. I added some lines to log the activity, and it seems that for those users, the hook isn't being called at all. The entry is still generated though.

    So I'm wondering what could be causing the hook to not fire. Any ideas?

    Thanks

    Posted 12 years ago on Tuesday May 8, 2012 | Permalink
  2. David Peralty

    Is there anything specific about "those users" that would group them to help identify the issue? Is it a problem for every user to the form, or just some? Can you post your functions.php to http://pastebin.com/ so I can take a look at it? Also a link to your form would help.

    Posted 12 years ago on Tuesday May 8, 2012 | Permalink
  3. Hi David

    The link to the form: http://www.klminirugby.com/membership-application-form/
    Function Source: http://pastebin.com/0ZpLLE6U

    There's nothing specific about those users, when I tried to fill up the form myself using the same values the user used, the PDF generates. So I'm not sure if its something the user is doing, or some odd hiccup on the server side.

    Thanks

    Posted 12 years ago on Thursday May 10, 2012 | Permalink
  4. David Peralty

    With what you are trying to do through the functions file, I am not sure what it could be. Everything looks fine to me, and the hook should be called every time. Maybe check your server logs to see if it is timing out in creating the PDF?

    Posted 12 years ago on Thursday May 10, 2012 | Permalink
  5. Hi David

    The problem is the function isn't even being called (sometimes), so the PDF creation code isn't even run. Hence it can't timeout. Whenever the function is called though, the PDF is created without a problem.

    So I'm wondering if there's something which would cause the hook to not be called, That might answer some questions.

    Posted 12 years ago on Sunday May 13, 2012 | Permalink
  6. David Peralty

    I've passed this on to the developers to see if they can find any instance that would cause the hook to not be called. I haven't heard of this issue before though.

    Posted 12 years ago on Monday May 14, 2012 | Permalink
  7. Can you provide us with FTP info and a WP Admin login so we can take a look? Please reference this post and send to rob@rocketgenius.com

    Posted 12 years ago on Tuesday May 15, 2012 | Permalink
  8. I am having a hard time replicating the problem (I sent a few forms but it fired every time), and by looking at the code it seems impossible for the entry to be created but the gform_pre_submission hook not get fired.
    There are a few alternatives to the gform_pre_submission hook that you can try using instead and see if you have better luck with them.
    You can use the gform_validation filter (http://www.gravityhelp.com/documentation/page/Gform_validation). Make sure you check the $validation_result["is_valid"] variable and only create the PDF if it is set to true. (i.e. the form passes validation). Make sure to return $validation_result at the end.

    You can also use gform_pre_submission_filter (http://www.gravityhelp.com/documentation/page/Gform_pre_submission_filter). Make sure to return $form at the end.

    Posted 11 years ago on Tuesday May 22, 2012 | Permalink