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.

Mapping Fields in Post Content Template

  1. signy
    Member

    I have several questions regarding how to map Custom Post fields in the Post Content Template area to the actual custom fields in a Custom Post type.

    Overview
    I am using an ecommerce plugin that has several custom fields in a custom "create new product" post type. The plugin has custom fields such as price, quantity, etc.

    I want to create a Gravity Form that takes the input from the form, creates a post automatically and populates each of those custom fields in the "create new product" post type. I have installed the "Gravity Forms + Custom Post Types" plugin for this purpose.

    I created a Gravity Form that uses both a Title Post Field and a Body Post Field. In the "Title Post > Advanced Field" area, I checked the "Save as Custom Post Type" and selected the "create new product" post type that came with the ecommerce plugin. In the Body Post Field, I checked the "Create Content Template" box and looked to insert the fields from the "create new product" plugin. I ran into several issues.

    Question 1

    None of the fields from the ecommerce plugin's "create new product" post type show up in the "Body Post Field > Create Content Template" drop-down list. How do I configure this so that the custom fields in the ecommerce plugin "create new product" custom post type show up in this drop down? These fields display in the custom page template that came with the ecommerce plugin.

    Question 2

    To try to figure out the mapping issue, I created a completely "New Custom Field" (not from the plugin). That "New Custom Field" did show up in the "Body Post Field > Create Content Template" drop-down list, so I selected that field and inserted the "New Custom Field" into the "Create Content Template" area. I saved the Gravity Form, filled out the Gravity Form section for the "New Custom Field" and submitted the Gravity Form.

    The information I typed into the "New Custom Field" showed up in the Body section of the Custom "Create a Product" Post instead of the "New Custom Field" section of the custom "create new product" post.

    How do I configure this so that data entered into Gravity Forms is mapped and shows up in the "New Custom Field" area of the "create new product" custom post -- and not just all in the body section of the custom post?

    Question 3

    I have questions on the correct format of inputs in the Post Content Template area. In the various forum posts I researched, I see suggested entries such as {post body:3} or {Post custom field:4}. Questions:
    a. In the input format "{Post custom field:4}", what does "post custom field" refer to and what does the "4" refer to?
    b. For a field that does not show up in the "Insert Field" drop down menu, how do you identify the correct ID of a field? (For example, if the field in the php template page is something like "purchase_price", would the field ID be "purchase_price"?)
    c. What would be the correct format for inserting a custom field named "purchase_price" in the Post Content Template area so that it shows up in the correct "purchase price" custom field (not just the body filed) of the "create a product" custom post type?

    Many thanks for any help on this.

    Posted 13 years ago on Friday June 17, 2011 | Permalink
  2. I'm not sure you understand what the Content Template is. The Content Template has nothing to do with custom post types, it's strictly a template for configuring the Post Body content itself. It's not for selecting a custom post type. The only options in the Content Template are the ability to insert the merge tag of other form fields into the Content Template, which are then replaced with the actual field value when the form creates the post.

    Whatever you enter in the Content Template for the Post Body field is what will be used for creating the Post Body for the post that is created. The Content Template simply lets you insert the value of other form fields using their merge tag, so it lets you create the Posy Body content using the values of multiple fields.

    The only thing in Gravity Forms that has to do with Custom Fields is the Custom Field post type.

    In your Question 3 above the {Post Custom Field:3} is the merge tag for a field on your form. The "Post Custom Field" is the field label, so you know which field it is by name, and the 3 is the field ID. These are merge tags for the fields on your form, they have nothing to do with posts.

    I'm not entirely sure what you are trying to do as I think there is confusion as to the terminology of what things are. You can't insert the value of custom fields for a post/page into the content template, you can only insert static text/html and merge tags for your form fields in the content template. If you are using the Post Custom Field type on your form, you can insert the value of that into the content template.

    Posted 13 years ago on Friday June 17, 2011 | Permalink
  3. signy
    Member

    Thanks for the reply. Several follow-up questions:

    1. So to confirm, the Content Template option only adds things into the Post Body area -- it cannot add data into other post fields?

    2. If the Content Template only adds things into the Post Body area, is there a fairly painless way to take the information and parse it into the different custom fields?

    3. My goal in purchasing Gravity Form was to have a simple front-end interface to submit "new products" by the end user without their having to see the full Dashboard -- and for these submissions to become posts so I don't have to copy and paste everything. Is there a way that Gravity Forms can do this?

    Posted 13 years ago on Friday June 17, 2011 | Permalink
  4. robwri32
    Member

    I'm looking for this exact functionality. Is it possible to use gravity forms to post data to different tables in my database? Exactly like the built in post buttons, only that data would be piped to a different area. Awaiting approval.

    Where would i start to solve this problem?

    Thanks in advance

    Posted 13 years ago on Friday June 17, 2011 | Permalink
  5. Question 2

    To try to figure out the mapping issue, I created a completely "New Custom Field" (not from the plugin). That "New Custom Field" did show up in the "Body Post Field > Create Content Template" drop-down list, so I selected that field and inserted the "New Custom Field" into the "Create Content Template" area. I saved the Gravity Form, filled out the Gravity Form section for the "New Custom Field" and submitted the Gravity Form.

    The information I typed into the "New Custom Field" showed up in the Body section of the Custom "Create a Product" Post instead of the "New Custom Field" section of the custom "create new product" post.

    How do I configure this so that data entered into Gravity Forms is mapped and shows up in the "New Custom Field" area of the "create new product" custom post -- and not just all in the body section of the custom post?

    I am having the same exact issue. I am also using the "Gravity Forms + Custom Post Types" plugin.
    Trying to summarize the issue:
    When using a custom field in GF, I am then selecting 'Custom Field Name' on the Properties tab of the field (happens to be a Paragraph Text field type) in GF. Lets call my field 'field_xyz'
    The goal is to pass the data put in the form field, to the custom field named 'field_xyz' in the post.
    This is NOT happening. Nothing is being passed to the post for that field. The data IS in the form entry for that field. Just not making it over to the post.
    What is wrong????

    Posted 13 years ago on Friday June 17, 2011 | Permalink
  6. @signy A few different fields have Content Template options. The Post Title, Post Body and Custom Field all have Content Template options which let you insert the value of other fields into them. So yes, you can configure a Content Template on a Custom Field to insert the value of other fields to create the value of that Custom Field.

    @robwri32 Your question is unrelated to what is being asked in this forum thread. If you want to post data to other databases or other database tables you have to write custom code to do so. There are hooks you can use to execute your custom code when a form is submitted. Look at the gform_post_submission hook in the Developer Docs area of the Documentation.

    @munman Make sure you have set the Custom Field Name. If it's not set to a value, the custom field won't be stored. Also test with a form that doesn't use custom post types, create a test form. See if it works on a standard form creating a standard Post. If it works when creating a regular post (not custom post type) then it's a problem with the Custom Post Type Add-On.

    Posted 13 years ago on Friday June 17, 2011 | Permalink
  7. Carl,

    And right you are.

    I did a test with a normal post, but with custom fields. All values in all fields are in postmeta.

    But NOT with a custom post type...
    I will be contacting the developer of the "Gravity Forms + Custom Post Types" plugin.
    FYI - for me, it seems not to be working for paragraph type custom fields only...
    Thanks for getting me on track to find this.

    P.S. - GF should just have the functionality of the "Gravity Forms + Custom Post Types" plugin in it, out of the box... hint... hint :)

    Posted 13 years ago on Friday June 17, 2011 | Permalink