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.

Oops! We could not locate your form - tied to call in functions.php

  1. agoranet
    Member

    I have read through the other "Oops!" posts and have tried the Meta Recovery Tool on my form as well as changing to a standard theme but I still get the following pattern:

    I have 2 forms. One of them (form with id=2) works fine even with a lot of custom filters in the functions.php file. The other one (form with id=1) works fine as long as I don't have any code for that form in the functions.php file. As soon as I add any code trying to work with that particular form, I cannot preview or use the form - I get the "Oops!" message.

    As a test, I tried adding this to my functions.php form and it breaks:

    [php]
    add_filter("gform_pre_render_1", "setup_item_order_form", 10, 2);
    function setup_item_order_form($form) {
    
    }

    If I add:

    [php]
    add_filter("gform_pre_render_1", "setup_item_order_form", 10, 2);
    function setup_item_order_form($form) {
         echo "hello";
    }

    Then it shows this when I load the page containing the form so it's getting to the pre-render:
    hello
    Oops! We could not locate your form.

    If I remove those lines, the form runs fine with or without the custom code that is there for Form #2.

    Any ideas?

    Setup is:
    Gravity Forms: 1.6.11
    WordPress: 3.5
    PHP Version: 5.3.2

    Posted 11 years ago on Wednesday January 9, 2013 | Permalink
  2. agoranet
    Member

    New test to add to the puzzle...
    I added a new form (ID = 4) and put one text field on it.
    The form works fine as long as no code in functions.php references it. If I add that same "hello" code but for form #4, form#4 can't be found.

    In all cases, form #2 still works fine.

    I wanted to rule out that there was something wrong with Form #1 itself but a new form does the same thing.

    Posted 11 years ago on Wednesday January 9, 2013 | Permalink
  3. agoranet
    Member

    I found a way around this. I'm using the generic "gform_pre_render" filter instead of doing the forms separately, e.g. "gform_pre_render_1" and "gform_pre_render_2"

    Then, within my gform_pre_render function I'm using:
    switch ($form["id"]) { } to provide chunks of code that apply to the specific form being used at the time.

    I guess it doesn't want you to have more than one gform_pre_render_* filter at a time even though they are for different forms.

    Posted 11 years ago on Friday January 11, 2013 | Permalink
  4. You can certainly use multiple gform_pre_render_{ID} filters, for different forms. I have dozens of them in my functions.php, so this is not the source of your problem. However, you found a work around and it's working for you which is the important thing.

    Posted 11 years ago on Friday January 11, 2013 | Permalink