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.

How to Put Form in a Widget?

  1. nicheplayer
    Member

    Hi Gravity Folks,

    How do I put a Gravity Form in a widget? (Similar to what we've done with aWeber HTML)

    I've tried both short form and php, neither work. I can't find HTML for my Gravity Form.

    Site is http://bigbearcabinrental.org/ using StudioPress theme. (Let Us Help You is the form)

    Thanks.

    David

    Posted 10 years ago on Tuesday July 27, 2010 | Permalink
  2. Currently Gravity Forms does not have a built in widget but it is coming in the 1.3.14 version of Gravity Forms. We will be releasing a beta of 1.3.14 sometime in the next 1-2 weeks.

    Until then there is a 3rd party widget available from Joost de Valk at Yoast.com that acts as a Gravity Forms widget and allows you to place a Gravity Form in your sidebar. You can download it here:

    http://yoast.com/gravity-forms-widget-update/#gf-widget

    If you use Joost's widget you will need to add this code to your themes function.php file to enqueue the necessary JS and CSS which his widget doesn't do automatically:

    wp_enqueue_script("gforms_ui_datepicker", WP_PLUGIN_URL . "/gravityforms/js/jquery-ui/ui.datepicker.js", array("jquery"), "1.3.9", true);
    
    wp_enqueue_script("gforms_datepicker", WP_PLUGIN_URL . "/gravityforms/js/datepicker.js", array("gforms_ui_datepicker"), "1.3.9", true);
    
    wp_enqueue_script("gforms_conditional_logic_lib", WP_PLUGIN_URL . "/gravityforms/js/conditional_logic.js", array("gforms_ui_datepicker"), "1.3.9", true);
    
    wp_enqueue_style("gforms_css", WP_PLUGIN_URL . "/gravityforms/css/forms.css");
    Posted 10 years ago on Tuesday July 27, 2010 | Permalink
  3. nicheplayer
    Member

    Thanks for the reply, Carl.

    What about just adding form HTML into an existing text/html widget?

    Posted 10 years ago on Tuesday July 27, 2010 | Permalink
  4. You can't copy-n-paste the form HTML, it won't submit properly. It has to be displayed using either the shortcode or function call for it to work properly.

    Posted 10 years ago on Tuesday July 27, 2010 | Permalink
  5. David: Another easy way to do it is to use the Exec PHP plugin (http://bluesome.net/post/2005/08/18/50/) which lets you put code in your posts, pages and text and then use Wordpress's do_shortcode method like so:

    <?php echo do_shortcode('[gravityform id=9]');?>

    Posted 10 years ago on Tuesday July 27, 2010 | Permalink
  6. skiminvasion
    Member

    Newport,

    Thanks for the tip, I've almost got it figured out using the Exec PHP plugin.

    The site is http://www.jonlash.com and the form's on the home page. When I just insert "<?php echo do_shortcode('[gravityform id=1]');?>" the form shows up, but won't display any information below it. What am I missing?

    (I've currently got it placed as the bottom widget so that the site can be functional for now)

    EDIT: figured out that the html widget doesn't seem to make a container for the contents unless there's a title typed out. Bizarre, but it's working for now

    Posted 10 years ago on Tuesday August 3, 2010 | Permalink
  7. Try using the function call instead of the short code.

    <?php gravity_form(1, false, false); ?>

    For information on how to use the function call see this page:

    http://www.gravityhelp.com/documentation/embedding-a-form/

    Shortcode is designed to be run by WordPress built in shortcode processor. Function call is designed to be used when calling it via PHP.

    Posted 10 years ago on Tuesday August 3, 2010 | Permalink
  8. skiminvasion
    Member

    thanks for the speedy response Carl, using the call code solved the title problem. Thanks!

    Posted 10 years ago on Tuesday August 3, 2010 | Permalink
  9. Didn't know about that function call, very handy!

    Posted 10 years ago on Tuesday August 3, 2010 | Permalink