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.

Help with Complex Theme

  1. I'm very new to all of this web programming and I cannot get my form to display. I tried using shortcode to call the Gravity Form in the following page:

    http://zephyrpoint.org/testing-ground

    but it is not displaying.

    A little background: My website is a custom theme that was built by another company for our business (Zephyr Point). Each page is built on a php template. I'm not at all versed in PHP, and I really don't want to activate another theme to test in that way - I can't really afford to take our website offline (I've never tried switching themes, but I assume it would be too drastic of a change for our sit - even for a minute).

    I tried creating an "evaluations.php" template based on an existing template to try and use a function call without success.

    Honestly, I kinda got stuck as the webmaster because I'm the "young tech guy", but with all of my other responsibilities, I cannot take time to adequately learn php or even basic web programming. I'm really hoping that GF will work with my site - the possibilities in the forms seem amazing. Is there any help you can offer to get this working on my site?

    If you need any further access to anything, let me know, along with a preferred way of sending it to you. Thanks a lot for your time.

    Posted 12 years ago on Wednesday September 12, 2012 | Permalink
  2. David Peralty

    Hi there, you'll need some knowledge to fix these kinds of things. The first issue I see is that your theme is using a very old version of JQuery.

    <script src="http://zephyrpoint.org/wp-content/themes/zephyr_point/javascripts/jquery-1.3.2.min.js"

    WordPress comes with 1.8 now by default. If you can change this call to point to a more recent version of JQuery 1.7 or above, then it would go a long way to helping solve your issue.

    Secondly, using Chrome, I inspected your page and saw the following JavaScript issue:
    ncaught TypeError: Cannot call method 'getElementsByTagName' of null xfade2.js:31

    If you could work to try to figure this out as well, it would probably help.

    Posted 12 years ago on Wednesday September 12, 2012 | Permalink
  3. Thanks David. Pretty sure I updated JQuery to 1.7.2 (though I'm not sure how to verify that).

    Now I'm looking at JavaScript... another thing that is mostly over my head. The xfade2.js function is currently only used on our homepage to scroll through pictures. The error you mentioned above ("ncaught TypeError: Cannot call method 'getElementsByTagName' of null - xfade2.js:31") came from a script in the header. I moved the script to default.php and took it out of header.php so the scrolling still works - hooray for no more issue, but my GF form still isn't loading.

    Any ideas on what to try next?

    Posted 12 years ago on Wednesday September 12, 2012 | Permalink
  4. David Peralty

    If you look at your footer, you'll see the issue. The scripts are being called in the footer instead of the header:

    <link rel='stylesheet' id='gforms_css-css' href='http://zephyrpoint.org/wp-content/plugins/gravityforms/css/forms.css?ver=1.6.7' type='text/css' media='all' />
    <script type='text/javascript' src='http://zephyrpoint.org/wp-includes/js/jquery/jquery.js?ver=1.7.2'></script>
    <script type='text/javascript' src='http://zephyrpoint.org/wp-content/plugins/gravityforms/js/gravityforms.js?ver=1.6.7'></script>
    <script type='text/javascript' src='http://zephyrpoint.org/wp-content/plugins/gravityforms/js/conditional_logic.js?ver=1.6.7'></script>
    <script type='text/javascript' src='http://zephyrpoint.org/wp-content/plugins/gravityforms/js/jquery.json-1.3.js?ver=1.6.7'></script>
    <script type='text/javascript' src='http://zephyrpoint.org/wp-content/plugins/gravityforms/js/jquery.textareaCounter.plugin.js?ver=1.6.7'></script>

    So you have a second JQuery call, and then all the rest of Gravity Forms' scripts. They should be outputted in your wp_head call.

    Posted 12 years ago on Wednesday September 12, 2012 | Permalink
  5. Okay. I checked the footer.php, and there are no scripts in the footer. However, there are no GF scripts in the header either. What I saw through Chrome->Developer Tools is that the scripts appear in the body only when the GF shortcode or PHP call is used (those scripts go away when I remove the shortcode or PHP call). I also tried adding to the header the scripts you listed in your last entry, but that didn't work either.

    I'm confident we'll get there. Thanks again for all your help, and I've already learned a lot today! Any more ideas?

    Posted 12 years ago on Thursday September 13, 2012 | Permalink
  6. David Peralty

    Add this call before your </head> in your theme:
    http://www.gravityhelp.com/documentation/page/Gravity_form_enqueue_scripts

    Posted 12 years ago on Thursday September 13, 2012 | Permalink
  7. Tried that too. I actually didn't know if it was supposed to be left as:

    <?php gravity_form_enqueue_scripts($form_id, $is_ajax); ?>

    OR to go ahead and fill in the parameters:

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

    I tried both without success. Thanks for sticking with me. I hope I'm not jeopardizing your time or anything, but I really appreciate your help, David. Any other ideas?

    Posted 12 years ago on Thursday September 13, 2012 | Permalink
  8. David Peralty

    It would be the second one, you posted, and now you have all the Gravity Forms files showing up in the header AND footer of your theme stopping Gravity Forms from working. You need them to only show up in the header area, and not the footer. If you could look into why they are in both, and try to correct your footer (view source and look for jquery), then it should work as expected.

    All my best!

    Posted 12 years ago on Thursday September 13, 2012 | Permalink
  9. WHOA! So, check this out... in the footer.php file I found this function call before the <div id="footer"> (still in the <body> <div> but after the end the #wrapper <div>)

    <?php wp_footer(); ?>

    I couldn't find that function in any of my php files except in one other place where it was written with a hash symbol (which, evidently is the same as commenting the line out):

    <?php #wp_footer(); ?>

    Anyway, evidently that function quite a bit (~ 40 lines of code). Anyway, I added the hash symbol to see what would happen and it took out the second jquery call and a lot of other stuff, but the Gravity Form works! I haven't seen any other repercussions on the site, but at least if I find anything serious, I know what I changed.

    Next stop - some CSS styling of the form and lots more education. Thanks again, David, for all of your help. Maybe this can help someone else some day.

    Posted 12 years ago on Thursday September 13, 2012 | Permalink
  10. David Peralty

    Yeah, so it looks like everything was being pushed through the wp_footer function, which it shouldn't have been. You may want to notify the theme developer and hopefully they can rectify it in a future version as other plugins might need to use that function to insert code, and commenting it out might create issues in the future.

    All my best!

    Posted 12 years ago on Thursday September 13, 2012 | Permalink