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.

form suddenly stops saving created form data

  1. yammy
    Member

    i'm running clean install, no other plugins, on /localhost/test/myform page.

    When i just create the form, It works normally, then I insert some new posts from the form it works, but suddenly it stops saving new entries. The form submits, and instead of showing the sucess text message, it opens the url like this :

    /localhost/test/myform/://#gf_4

    it shows no sucess text, and doesn't save entries anymore, opens the single template page with odd values, listing all other posts in sequence.

    I increased php memory in wpconfig, tried resaving the form and no go. I copied the form into another form, and it worked again for a while, then again, the odd string started showing at the url and no more new entries.

    The form is somehow not reliable. Anyone can tell me why this is happening, and how to debug this? Where this odd string comes from ? Which file prints this instead of the sucess text ?

    Thanks

    Posted 11 years ago on Wednesday November 28, 2012 | Permalink
  2. yammy
    Member

    I figured it out that what causes the error is when I use the pair:

    add_filter( "gform_pre_submission_filter_1", "pre_submission_filter_1");
    function pre_submission_filter_1( ) { }

    Whenever I use this pre_submission_filter, even if the function itself has no code inside, the odd string after url starts showing. So it's something I'm missing, did I forget to do something else after the filter ?

    Thanks

    Posted 11 years ago on Thursday November 29, 2012 | Permalink
  3. yammy
    Member

    I tried changing this to add_action, and still the same behavior. When I add filter or action of pre_submission, the odd string /:/ appears on url after submit, the page goes 404, and the entry doesn't save anymore.

    Please I need to make changes to the data before saving it, can anyone help me with that!?

    Thanks!

    Posted 11 years ago on Thursday November 29, 2012 | Permalink
  4. yammy
    Member

    So, what I have to do to get some support here????

    Posted 11 years ago on Thursday November 29, 2012 | Permalink
  5. Can you export that form please and email it to me at chris@rocketgenius.com. Also, please send me the function you are using with your gform_pre_submission_filter so I can add that and see what happens on my server. Thank you.

    Posted 11 years ago on Saturday December 1, 2012 | Permalink
  6. yammy
    Member

    You don't need the form. The error happens when i use add_filter and pre_submission:

    http://pastebin.com/ZpwE4aUY

    When i let the add_filter alone or together with add_action, the error happens everytime. When i comment the add_filter, and use only the add_action, it does work bugless.

    I wonder why the action works and the filter does not. They both are beeing called by form_display.

    Yesterday I pinpoint the problem using a debugger with breakpoints on every $form.
    I noticed that when using the add_filter, at some point in form_display.php code, the $form var turns into null (???), and a cascade of errors happens until the rest of code, ending up on the :// string after the url, the 404 error and no record savings.

    I hope it helps you on fixing the issue. I'm using add_action for now, but I really would like to know why the add_filter behaves like that and the add_action doesn't. If you fix it, please let me know.

    Also, what's the difference of using filter or action? They look the same to me. Are they for different purposes ?

    Thanks

    Posted 11 years ago on Saturday December 1, 2012 | Permalink
  7. Here is a good explanation of how action hooks and filters are different:
    http://ottopress.com/2011/actions-and-filters-are-not-the-same-thing/

    I see you're setting the global $_POST in your code. I've never seen that in a gform_pre_submission_filter function. What is the purpose of that?

    Also, when using the gform_pre_submission_filter, you should return the modified $form object. I don't see you modifying the $form object at all, much less returning it.

    Maybe you want to use the gform_pre_submission action hook instead? They're used differently.

    Posted 11 years ago on Sunday December 2, 2012 | Permalink