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.

WordPress Meta Box, Select List of Created Gravity Forms?

  1. What I'd love to be able to do is have a list of created forms in a select list so that my Custom Post Type can have a specific form assigned to it.

    <select name="gform-list">
    <option value="2">My Second Form</option>
    <option value="6">Another Form</option>
    <option value="7">Special Form</option>

    So in this case, I can select a form (id) and render it within my Custom Post Type :)

    gravity_form(6, false, false, false, '', false);

    Posted 7 years ago on Thursday July 12, 2012 | Permalink
  2. Can you share a little bit more of what you mean? The meta box will be in the wp-admin, and a list of your forms will be in a select dialog in the meta box. But what happens after the form is selected?

    Posted 7 years ago on Friday July 13, 2012 | Permalink
  3. ...what happens is the the ID of the gravity form selected will be saved as meta information for the post. Then I can use that ID to render the form appropriately.

    Posted 7 years ago on Friday July 13, 2012 | Permalink
  4. Ah. OK. So, when the form is selected from your drop down, a custom field (meta key) is created, and that value is the form ID. Then you have code in your template (maybe?) to render the proper form by ID? Is that the scope of the problem? Thanks.

    Posted 7 years ago on Friday July 13, 2012 | Permalink
  5. Chris,

    Yes, that is basically the need. Again:

    I just need to be able to pull in all of the Forms. I then render a Select list so that a specific form can be chosen to represent that page. I will then use the saved ID to render that GForm on the page.

    Without using WP_Query, is there another "official" way to pull in an array of GForms?

    Posted 7 years ago on Monday July 16, 2012 | Permalink
  6. I think you can use this Gravity Forms admin function to pull in a list of forms:

    $forms = RGFormsModel::get_forms($active, "title");

    That code is found in form_list.php on line 50 (in my version of Gravity Forms.) Bear in mind that Gravity Forms is not designed to be used in the post editor area, but I think you should be able to use some of the internal functions to populate your drop down.

    Posted 7 years ago on Tuesday July 17, 2012 | Permalink