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.

Gravity_form_enqueue_scripts documentation page incomplete, cut off

  1. this page is incomplete: http://www.gravityhelp.com/documentation/page/Gravity_form_enqueue_scripts

    the first sentence is cut off. Also it does not indicate WHERE you should be putting the enqueue script. in the functions.php file of your theme i assume. also it does not mention if you need to run that on an action such as init and then wrap it in a function. or maybe not.

    Posted 13 years ago on Thursday April 7, 2011 | Permalink
  2. danielpettifer
    Member

    I have successfully used the enqueue scripts in the page templates of my forms. I was having trouble getting the animation and conditional logic to work. Here is a copy of my page template (not sure if it helps)

    <?php
     /*
     Template Name: upload document
     */
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
      <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
      <meta name="MSSmartTagsPreventParsing" content="true" />
      <meta http-equiv="Imagetoolbar" content="No" />
      <title>My Form Title</title>
      <style type="text/css">
    #fakeprogress {
    	background-color:#ceecff;
    	border:2px solid #ADDEFC;
    	background-image:url(http://www.docsense.net/wp-content/themes/parallelus-traject/ajax-loader.gif);
    	background-repeat:no-repeat;
    	background-position:center 65px;
    	height:120px;
    	width:400px;
    	position:absolute;
    	top:50%;
    	left:50%;
    	margin-top:-60px;
    	margin-left:-200px;
    	z-index:100;
    }
    #fakeprogress h2 {
    	text-align:center;
    	margin:0;
    	padding:25px 0 0 0;
    	font-weight:bold;
    	font-size:24px;
    	font-family:sans-serif;
    }
    </style>
    
      <style type="text/css">
      	body {font-size:13px;}
      </style>
    
      <link rel='stylesheet' id='gforms_css-css'  href='<?php bloginfo('url'); ?>/wp-content/themes/parallelus-traject/css/gravforms.css' type='text/css' media='all' />
      <script type='text/javascript' src='<?php bloginfo('stylesheet_directory'); ?>/includes/js/jquery-142.js?ver=1.4.1'></script>
      <script type='text/javascript' src='<?php bloginfo('url'); ?>/wp-content/plugins/gravityforms/js/conditional_logic.js?ver=1.3.13.1'></script>
     <?php wp_head(); ?>
      <?php
    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");
    }
    ?>
      </head>
    <body>
    
      <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
      <?php the_content('read more'); ?>
      <?php endwhile; endif; ?>
      <?php gravity_form_enqueue_scripts(7,true); ?>
      <?php gravity_form(7, false, false, false, '', true); ?>
      <?php wp_footer(); ?>
    </body>
    </html>

    Also here is another link that works for information on embedding forms http://www.gravityhelp.com/documentation/page/Embedding_A_Form

    Posted 13 years ago on Thursday April 7, 2011 | Permalink
  3. thanks for the reply! I was more pointing out missing documentation than asking for help.

    I used this instead:

    function my_init() {
    	if (!is_admin()) {
    		gravity_form_enqueue_scripts(1, false);
    	}
    }
    add_action('init', 'my_init');

    and put it in the themes' function.php file and it seems to take care of everything.

    Posted 13 years ago on Thursday April 7, 2011 | Permalink
  4. danielpettifer
    Member

    You are welcome : ) Some of the documentation is a bit screwed as they just updated everything but as long as people point it out they will fix it!

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