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 not showing - error

  1. semrocc
    Member

    I have been unable to embed a new form since upgrading to GF 1.5. When trying to view the form live, I get the page to load, but no form. IE gives the error "Message: Object doesn't support this property or method", FF is just the page without the form.

    I use the following in my theme template:

    <?php gravity_form(5, false, false, false, '', true); ?>

    As well, the following in my function.php theme file:

    if(!is_admin()) {
        wp_enqueue_script("gforms_ui_datepicker", WP_PLUGIN_URL . "/gravityforms/js/jquery-ui/ui.datepicker.js", array("jquery"), "1.4", true);
        wp_enqueue_script("gforms_datepicker", WP_PLUGIN_URL . "/gravityforms/js/datepicker.js", array("gforms_ui_datepicker"), "1.4", true);
        wp_enqueue_script("gforms_conditional_logic_lib", WP_PLUGIN_URL . "/gravityforms/js/conditional_logic.js", array("gforms_ui_datepicker"), "1.4", true);
        wp_enqueue_style("gforms_css", WP_PLUGIN_URL . "/gravityforms/css/forms.css");
    }

    The form shows in the admin preview, no problem. I can also swap out my form id in the theme file and the old forms (made before the upgrade) work.

    Any help would be appreciated...thanks!

    Posted 13 years ago on Sunday March 27, 2011 | Permalink
  2. semrocc
    Member

    Ok...found the culprit. When using the new "Maximum Characters" in a description field, the form does not display. When the "Maximum Characters" criterea does not exist, all displays as it should.

    Hope you can get this fixed soon...thanks!

    Posted 13 years ago on Sunday March 27, 2011 | Permalink
  3. Gravity Forms v1.5 introduced some new scripts and features which are not getting included. It also introduces a new way to enqueue scripts to insure all the necessary scripts are loaded without you needing to know which one to load.

    Details and documentation on the new enqueue function can be found here:

    http://www.gravityhelp.com/documentation/page/Gravity_form_enqueue_scripts

    Posted 13 years ago on Monday March 28, 2011 | Permalink
  4. semrocc
    Member

    Thanks for the response Carl, but not being a programmer, this is very confusing. Where does this code go? I tried placing it on the same page as the form and in the function file and both didn't work.

    Some guidance would be appreciated :)

    Posted 13 years ago on Monday March 28, 2011 | Permalink
  5. You would replace this in your themes functions.php file:

    if(!is_admin()) {
        wp_enqueue_script("gforms_ui_datepicker", WP_PLUGIN_URL . "/gravityforms/js/jquery-ui/ui.datepicker.js", array("jquery"), "1.4", true);
        wp_enqueue_script("gforms_datepicker", WP_PLUGIN_URL . "/gravityforms/js/datepicker.js", array("gforms_ui_datepicker"), "1.4", true);
        wp_enqueue_script("gforms_conditional_logic_lib", WP_PLUGIN_URL . "/gravityforms/js/conditional_logic.js", array("gforms_ui_datepicker"), "1.4", true);
        wp_enqueue_style("gforms_css", WP_PLUGIN_URL . "/gravityforms/css/forms.css");
    }

    With this:

    gravity_form_enqueue_scripts(5, true);

    The 5 is the form id the true is for saying AJAX is being used.

    Posted 13 years ago on Monday March 28, 2011 | Permalink
  6. semrocc
    Member

    Thanks for the info.

    I also have 2 other forms that I am using, woud I include the following in the function.php file?

    gravity_form_enqueue_scripts(1, true);
    gravity_form_enqueue_scripts(3, true);
    gravity_form_enqueue_scripts(5, true);

    Thanks again!

    Posted 13 years ago on Monday March 28, 2011 | Permalink
  7. Yes, that is what you would have to do.

    Ideally you'd wrap each function call in an if statement or use a switch statement so that that function call only gets called when you are on the page that contains that form.

    Posted 13 years ago on Monday March 28, 2011 | Permalink
  8. semrocc
    Member

    Hi Carl,

    Again, as a non-programmer...I don't know how to code the if or switch statements. Would be nice to see some example code in the documentation if possible.

    Thanks again!

    Posted 13 years ago on Monday March 28, 2011 | Permalink
  9. I'll have another developer post an example in a little bit to get you started.

    Posted 13 years ago on Monday March 28, 2011 | Permalink
  10. semrocc
    Member

    Thanks Carl, much appreciated.

    Posted 13 years ago on Monday March 28, 2011 | Permalink
  11. Assuming that all of your forms are on a specific post or page and not in the sidebar or something like that, this switch case should do the trick for you.

    http://pastie.org/1727746

    Posted 13 years ago on Monday March 28, 2011 | Permalink
  12. semrocc
    Member

    Thanks David...I will work with this.

    Would it make sense to include this example or others in the GF Documentation, it would probably be of value seeing it there as well...just a thought.

    Posted 13 years ago on Monday March 28, 2011 | Permalink
  13. semrocc
    Member

    Ok...I tried both suggestions and they both didn't work.

    Carl, when I tried replacing my old function code with:

    gravity_form_enqueue_scripts(1, true);
    gravity_form_enqueue_scripts(3, true);
    gravity_form_enqueue_scripts(5, true);

    I got the following fatal error:

    [28-Mar-2011 23:07:20] PHP Fatal error: Class 'GFCommon' not found in /path-to-file/wp-content/plugins/gravityforms/gravityforms.php on line 1201

    David, when I tried your code...2 of my forms didn't show and one was all messed up because it didn't seem to see the css.

    I would like to just use something that works, how can I ad jquery.textareaCounter.plugin.js to my original function code so that it works and is this the only thing I would need to use the Character limiter?

    Thanks again

    Posted 13 years ago on Monday March 28, 2011 | Permalink
  14. semrocc
    Member

    I have now reconstructed my form pages and switched over to the Shortcode method and all seems to be working good...actually, this seems to be much simpler.

    Thanks again!

    Posted 13 years ago on Tuesday March 29, 2011 | Permalink
  15. @semrocc,

    Thanks for the update. We're glad you've got everything working well now.

    Posted 13 years ago on Tuesday March 29, 2011 | Permalink
  16. Sbyrakis
    Member

    Hi guys,

    I have the same type of problem and unfortunately I can not switch to shortcodes, I want to embed a form to a template of a buddypress component extension (BuddyPress Skeleton Component). The form works well in a static page, using shortcodes.

    Placing the following code in the content area of the template, inline with html, does not produce any output.

    <?php gravity_form(2, false, false, false, '', true); ?>

    I have tried to disable ajax, no success

    Can you give me some direction?

    Thanks
    Stelios

    Posted 13 years ago on Friday April 1, 2011 | Permalink
  17. @sbyrakis Does the form have conditional logic in it? If so then you probably aren't enqueuing the necessary scripts. If you are calling a form via the function call you have to enqueue the scripts. See this documentation:

    http://www.gravityhelp.com/documentation/page/Gravity_form_enqueue_scripts

    Please note the enqueue function needs to be used somewhere that it isn't executed too late in the WordPress page execution process so it can enqueue the scripts. The usual place is your themes functions.php file.

    Posted 13 years ago on Friday April 1, 2011 | Permalink
  18. Sbyrakis
    Member

    Thanks Carl, this worked like a charm!

    :)

    Posted 13 years ago on Thursday April 7, 2011 | Permalink

This topic has been resolved and has been closed to new replies.