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 find out what form ids exist?

  1. I have been working on a plugin that imports forms via the xml function that Gravity Forms has internally. I am then creating pages and inserting the short code as well as part of the plugin setup. I know I can match my form title to see what the correct formID is for each one, but I don't know what form ids actually exist. I found this below to grab the form info so I can check against the form title, but how do I know what form ids exist? Is there something that grabs an array of all form ids?

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

    Posted 11 years ago on Wednesday August 8, 2012 | Permalink
  2. Hi Scott. You just want an array of all active form IDs, from the database?

    Posted 11 years ago on Wednesday August 8, 2012 | Permalink
  3. Yeah, that is my thoughts, then I can loop through them and find out which form id matches the form title that I want. Which would be unique... since the form id can/will change from install to install.

    Posted 11 years ago on Wednesday August 8, 2012 | Permalink
  4. Hi Scott. This function:

    [php]
    //  the 1 means "active"
    $forms = RGFormsModel::get_forms(1, 'id ASC');

    Will return an array of all active forms. The $forms array looks like this is you dump it:

    Array
    (
        [0] => stdClass Object
            (
                [id] => 2
                [title] => Video Submission
                [date_created] => 2011-07-19 02:45:34
                [is_active] => 1
                [lead_count] => 0
                [view_count] => 182
            )
    
        [1] => stdClass Object
            (
                [id] => 3
                [title] => Country of Origin
                [date_created] => 2011-07-23 03:20:33
                [is_active] => 1
                [lead_count] => 17
                [view_count] => 227
            )
    
        [2] => stdClass Object
            (
                [id] => 4
                [title] => Register
                [date_created] => 2011-07-24 20:34:27
                [is_active] => 1
                [lead_count] => 3
                [view_count] => 273
            )
    // etc, etc.

    You can loop through that $forms array and grab all the IDs. Will that work for you?

    Posted 11 years ago on Wednesday August 8, 2012 | Permalink