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.

jQuery To Detect All Forms (And Their IDs) On A Given Page

  1. jQuery To Detect All Forms (And Their IDs) On A Given Page

    Do you know if this code exists anywhere and if so, can you please point me in the right direction. I can write this custom, if needed, but if it already exists--that would certainly save me time.

    The idea is to detect all forms and their relative IDs that exist on the page and then loop through those IDs passing them to your Google OnClick Event Tracking code: ( http://www.gravityhelp.com/forums/topic/onclick-tracking#post-7734).

    The purpose of this is to:

    1.) To automatically create the necessary Event Tracking code, instead of manually having to add hard coded Form IDs every time a new form is created--which is a bit labor intensive in the long run.

    2.) To reduce load time--as opposed to trying to loop through all form IDs in the database--by only writing the Google code for forms detected on that page.

    Thoughts?

    Posted 11 years ago on Tuesday September 11, 2012 | Permalink
  2. There is no code to do that that I am aware of. Whenever a Gravity Form is added to a page, the form ID is added a couple times:

    <div id='gform_wrapper_134' >
    <form id='gform_134'>

    You should be able to go through the page and grab the form IDs know that string will exist every time a form is embedded. If you need additional help with this, please let us know. And we would love to see the code you come up with when you're done. Thank you.

    Posted 11 years ago on Saturday September 15, 2012 | Permalink