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.

Dynamically populate Gravity Form with content from a custom post type

  1. lydianweb
    Member

    I'm currently using gravity forms as a simple wholesale order form. The current form is here: http://wholesale.pgdesign.us/ Password is "pochi1234" (Please don't place an order!!).

    I would like to be able to have parts of this form generated dynamically. Specifically, if I could have the products pulled from a custom post type, the time required to maintain the form would be reduced significantly. As it is now, it's pretty tedious to update the form if a product picture changes or if we add a new product.

    I looked through the documentation and I saw references to pulling content to populate a dropdown menu, but I didn't see anything that could pull large amounts of content from a custom post type to populate a form. Is this possible?

    Thanks!

    Posted 9 years ago on Wednesday August 1, 2012 | Permalink
  2. lydianweb
    Member

    Does anyone have any experience with this or am I better off finding an alternate solution?

    Posted 9 years ago on Friday August 3, 2012 | Permalink
  3. How is the information stored in a custom post type? Do you mean there are posts of a specific custom post type, and you want to pull information from those posts? Or is the information stored some other way? The custom post type just gives you a template for the information which will be required and allowed for the post, but how are you using Custom Posts now and how do you need to use that information to populate your forms?

    With a little more information or examples, we can help figure out if it's possible to do what you want to do. Thank you.

    Posted 9 years ago on Saturday August 4, 2012 | Permalink
  4. lydianweb
    Member

    Hi Chris,

    Thanks for the reply.

    As it is now, adding a product to the form involves adding multiple fields and editing HTML, all of which is relatively slow and tedious in the forms editor. It would be great if there was a way to automate the creation of sections of fields and HTML for a form.

    I was thinking a custom post type would be an easy way to input the data for different products (name, cost, weight, item code, color options, etc.), which could then be accessed by Gravity Forms to populate the order form. I wouldn't be using the posts anywhere on the site, so maybe this isn't the most efficient way of storing the data. I guess what I really want is a way to create a class in Gravity Forms that consists of a set of fields and some HTML.

    Were you able to look at the form? You can see that each product has the same info, but when it comes time to add 10 new products I'm going to have to add 100 new fields, one by one.

    Posted 9 years ago on Saturday August 4, 2012 | Permalink
  5. GZA
    Member

    I think the custom post type approach could be a solution and if you were to combine that with the Advanced Custom Fields plugin (which is an excellent tool by the way), then you could create a great product catalogue which would be a breeze for you to maintain because the ACF will help you create custom meta boxes in your write panel.

    But, the question is, why on earth would you use Gravity Forms for this? It doesn't make sense.

    A better solution may be found with Woo Commerce.

    Posted 9 years ago on Saturday August 4, 2012 | Permalink
  6. lydianweb
    Member

    Thanks for the input GZA. I really like Types (http://wp-types.com/) for handling custom post types.

    My client doesn't want/need a full ecommerce system in place for his wholesale customers. He wants something that looks like an order form, and Gravity Forms does a good job of meeting that requirement.

    Did you take a look at the whole order form I have up now? Is that something Woo Commerce would be able to handle?

    Thanks!

    Posted 9 years ago on Saturday August 4, 2012 | Permalink
  7. GZA
    Member

    @lydianweb It's easy to create custom post types (and taxonomies) by hand or using the online generator.

    Types & Views is not, in my opinion, as good as ACF for custom fields and it doesn't seem to support repeater fields.

    Using Woo Commerce would negate the need of ACF and Types & Views and it has Gravity Forms extension:

    http://www.woothemes.com/extension/gravityforms-product-addons/

    I'm not saying GF isn't up to handling order forms but it will have its limitations and you'll have to do more work to get what you want.

    Posted 9 years ago on Sunday August 5, 2012 | Permalink
  8. theslink2000
    Member

    I'm also attempting something similar. I've got Types and Views storing my custom post types that are created through Gravity Forms via Custom Post Types and I am using the post types to store potentially large numbers on posts in each type. So far I've got everything working nicely but I'm trying to figure out how to dynamically populate a GForm with say the address section of a post so it can be edited and resubmitted via update_post_meta() but I can't figure out how to load the information back into a GForm to start with.

    Honestly, dynamic population keeps tripping me up but I get there in the end but because this is something that kinda falls between plugins I'm struggling, especially how to reference specific custom fields data.

    Anyone got any ideas?

    Posted 9 years ago on Friday August 10, 2012 | Permalink
  9. This would be pretty handy. I'm trying to build a gift registry - it'd be handy to be able to pull the list of the published custom type into a checkbox feild.

    Posted 9 years ago on Saturday August 11, 2012 | Permalink
  10. theslink2000
    Member

    For what you're talking about francisbond, I'm not too sure why you're thinking of a checkbox field. Wouldn't a list box be better? Unless of course you want multi select I suppose...

    Either way I've got a couple of clue I'm working towards, the first of which I code I found to dynamically populate a drop down with all published posts of a specific custom post type, see here:

    http://pastie.org/4459742

    There is also stuff that seems useful in this post:

    http://www.gravityhelp.com/forums/topic/dynamic-population-problem-with-multiple-filters

    If we work together here maybe we can figure this out.

    Posted 9 years ago on Sunday August 12, 2012 | Permalink
  11. theslink2000
    Member

    I've cracked it! Have a look at my complete write up for the solution http://www.gravityhelp.com/forums/topic/how-ive-built-a-editing-form

    Posted 9 years ago on Friday August 17, 2012 | Permalink