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.

Bug that I can't figure out

  1. I am trying to implement the Javascript technique of clearing a default field of a form on click. I have read on the forum two places that describe how to do it...
    http://www.gravityhelp.com/forums/topic/where-should-i-place-custom-jquery and
    http://www.gravityhelp.com/clearing-default-form-field-values-with-jquery/

    I have more than one form on my website but my concern is the form in the header. This technique is being used on a form in my header on all pages - an example is here...
    http://testing.musedigitaldesign.com/site8/ and the form at the bottom of the this page...
    http://testing.musedigitaldesign.com/site8/products/success-workshops/

    The technique will work for both the form in header and the form at the bottom of the page on the second link. But for some reason, it will not work on the header form on any other page.

    Does this bug make any sense to anyone? I'm baffled by it.

    Like I said, this same bug occurs with either technique from the top of this post.

    Posted 12 years ago on Wednesday July 18, 2012 | Permalink
  2. Just an aside:

    As a test, I placed an invisible form at the bottom of a page. When I did that, the javascript for the form in the page's header started working.

    So the scenario is...if there is another form on the page, the javascript in the header works. If the header form is the only form on the page, the javascript doesn't work.

    Does anyone know what is it about the second form on the page that is making the javascript for the header form work properly?? And what can I do that doesn't involve putting a hidden form on each page to make that script work in the page's header.

    Thanks.

    Posted 12 years ago on Wednesday July 18, 2012 | Permalink
  3. How are you putting the form into the header? If it's hard coded in the template or using the function call, you will need to enqueue the scripts and styles yourselves. When you have another form on the page, it's possible the scripts are being enqueued properly, and those required scripts are available for the header form.

    One of these may be required:
    http://www.gravityhelp.com/documentation/page/Gravity_form_enqueue_scripts
    http://www.gravityhelp.com/documentation/page/Gform_enqueue_scripts

    Posted 12 years ago on Wednesday July 18, 2012 | Permalink
  4. Hi,
    I have created a "sidebar" in the header's template and then placed the form using the Gravity form widget.

    Posted 12 years ago on Wednesday July 18, 2012 | Permalink
  5. The problem is most certainly that jQuery is not defined on the pages where the placeholder text will not clear. See the JavaScript error on this page http://testing.musedigitaldesign.com/site8/

    Timestamp: 7/18/2012 6:23:47 AM
    Error: jQuery is not defined
    Source File: http://testing.musedigitaldesign.com/site8/wp-content/themes/NewLifePurpose/gravityforms.js
    Line: 3

    I'm not sure why jQuery is not being included (that will require some troubleshooting on your part). Can you try adding it using the gravity_form_enqueue_scripts filter?

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

    Posted 12 years ago on Wednesday July 18, 2012 | Permalink
  6. Thank you. That fixed the problem. I think the clue on why it wasn't working can be found on the page you sent me to regarding the gravity_form_enqueue_scripts filter. At the top of the page, it states... This is useful when manually embedding a form outside the WordPress loop.

    Even though the form is placed within a "sidebar" and uses a widget, it actually isn't inside the Wordpress loop. Which is probably why it does work when another form is placed elsewhere on the page within the loop.

    So that definitely solves the problem.

    Thanks!

    Posted 12 years ago on Thursday July 19, 2012 | Permalink

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