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.

Form with many fields to create a Post

  1. I read a recent post that Carl said:

    Using Gravity Forms to create a Post is super easy. There are a group of fields in the Form Editor called Post Fields. It consists of the following fields:

    - Post Title
    - Post Body
    - Post Excerpt
    - Post Category
    - Post Tag
    - Post Image
    - Post Custom Field

    All you do is add those fields to your form (at a minimum the Post Title and Post Body fields) just like any other field and when the form is submitted a post will be created using the information entered in those fields.

    There isn't really much to it other than that.

    Does this mean that we can only use those fields? What if I have my own form with several unique fields? Is it possible to take the entire results of all the fields with their labels and create a post that way? The only other way that I can think of is to take the submitted email and copy and paste that into a new Post by hand. My client would prefer that the post gets created dynamically.

    In another post Carl said:

    The Post Body is already a regular form field that people can fill in, however it is only one field and does not consist of multiple fields.

    In order to combine multiple fields into the Post Body what you would have to do is use PHP and the pre-process form hook to combine the fields and populate the Post Body. This would require some PHP knowledge to pull off.

    How familiar with PHP are you?

    I'd like to get this information that you were possibly going to share.
    I am an intermediate with PHP coding - just enough to get myself into trouble but well enough to understand what I see.

    Thank you for your help!
    Chris

    Posted 7 years ago on Thursday April 28, 2011 | Permalink
  2. Only Post Fields create Post Data. Gravity Forms doesn't even try to create a post unless a Post Title or Post Body field are present in the form. The presence of those fields is what tells Gravity Forms to create a post.

    If you want to create a post using the value of other fields on your form you can do this using the Content Template feature of the Post Body field. Add a Post Body field to your form, edit it and then enable the Content Template. It will reveal a textarea where you can then insert the value of other form fields into your content template. Think of the content template as the actual post content, whatever is in the content template is what will be used to create your post. You can insert form field values via merge codes using the "Insert form field" drop down just like you can with Notifications.

    You can also then set the visibility of that Post Body field to admin only via the Advanced tab when editing the Post Body field and it will hide the Post Body field, but still execute the content template if you configured one and create the post.

    So yes, you can use non-Post fields as part of your post data but you have to have a Post Title and Post Body field on the form for a Post to be created.

    The Post Title also has a Content Template feature that lets you format the Post Title using values from other form fields.

    Posted 7 years ago on Thursday April 28, 2011 | Permalink