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.

Publish form results automatically on a new post/page

  1. flameboyuk
    Member

    I'm trying to create a form in which selected results can be published onto a new post/page automatically for the user to review what they had inputted. Is there anyway of doing such a thing? This data could then be updated through the admin panel.
    On a related note, can you let me know how you would go about outputting to a page instead of a post?

    Any help would be much appreciated.

    Posted 14 years ago on Sunday April 25, 2010 | Permalink
  2. Part 2: You can create pages instead of posts. How to do it is described here:
    http://forum.gravityhelp.com/topic/can-pages-be-created-from-form-submissions#post-1832

    Part 1: Sounds like you're looking for a way to show the users what they've submitted, on sort of a confirmation page, before actually submitting it for your review?

    Posted 14 years ago on Sunday April 25, 2010 | Permalink
  3. Gravity Forms doesn't currently support confirmation pages to verify and then submit the form information. This is a feature that we plan on offering in the future, however in order to accomplish it now you would have to do it yourself using the available API hooks... although it would be a more advanced customization.

    Posted 14 years ago on Sunday April 25, 2010 | Permalink
  4. flameboyuk
    Member

    Hey there. Thank you for that. Unfortunately however, when I enter the code given in the other post into functions.php, my screen goes white and I cannot access the Wordpress dashboard and the same goes for the website (both just white blank pages). Any ideas?

    Regarding the other issue, It's not for a confirmation page. Its basically so that the user and other parties can review the specific user's results after submission. It's fine if it needs to be confirmed first by myself though before publishing, as long as the data is all automatically inputted.

    Here is my functions.php with the script at the bottom...

    http://pastie.org/934952

    Posted 14 years ago on Sunday April 25, 2010 | Permalink
  5. If you have it submitted, you can select to have it 'Pending Review', so you can check it out before making it live on the site.

    Posted 14 years ago on Monday April 26, 2010 | Permalink
  6. flameboyuk
    Member

    Thanks. Got it! That's great but how can I make i automatically import all the data collected from the form. The only ones which seem to work at the moment are post title, body, image. It won't import my custom fields into the body. Is this possible?

    Posted 14 years ago on Monday April 26, 2010 | Permalink
  7. You have to use those custom fields in your page template. Gravity Forms did its job by collecting the data, but now you need to decide how to display the data in your page template. There are WordPress functions to handle that:

    http://codex.wordpress.org/Function_Reference/get_post_meta
    http://codex.wordpress.org/Function_Reference/get_post_custom

    Posted 14 years ago on Monday April 26, 2010 | Permalink
  8. flameboyuk
    Member

    Thank you for that Illilnoissharley. It's good to know it's possible. Those links you sent me are useful but for a noob, it would be good if there was a step-by-step guide for doing this.
    I've spent the last half an hour going through Google looking for something to help but I'm not entirely sure what to look for in relation to Gravity Forms.

    If someone knows of a guide or can offer me one, that would be much appreciated.

    Posted 14 years ago on Monday April 26, 2010 | Permalink
  9. flameboyuk, if you post the name of one of the custom fields you created, and show you how want to use it in your template, I can post the code to get you started. Once you do one, you will see how easy it is to do the rest. I'm not sure of a guide or resource online other than the Codex, even though there probably is one.

    Posted 14 years ago on Monday April 26, 2010 | Permalink
  10. flameboyuk
    Member

    Hi Illinoissharley, I really appreciate your help. One of them is a single line text in a post custom field called "town". I also have a post custom field as a multiple choice called "Likes".

    I would basically like them to appear in the body text of the post with perhaps a title before such as "Your likes:" followed by what they chose. Underneath a title like "where you live:" followed by their town name.

    Your likes: choice 1, choice 2 etc,
    Where you live: Town name

    There are a few more but if you could give me some help with one or both, I will try and work the rest out from there. Is that everything you need to know?

    Once again, thank you so much for the help.

    Posted 14 years ago on Monday April 26, 2010 | Permalink
  11. If you place this into your single.php file, it will only show up when there is a custom field called 'Your Likes' or 'Town' included, or just one of them. So if it is just a normal post, or results from a different form, it will not show up.

    <?php if( get_post_meta($post->ID, "likes", true) ): ?>
    <b>Your Likes: </b><?php echo get_post_meta($post->ID, "likes", true); ?>
    <?php else: ?>
    <?php endif; ?>
    
    <?php if( get_post_meta($post->ID, "town", true) ): ?>
    <b>Where you live: </b><?php echo get_post_meta($post->ID, "town", true); ?>
    <?php else: ?>
    <?php endif; ?>

    Now you have that, you should be ok at doing the rest.

    We are using this for an events calendar on a site about Hampshire.

    Posted 14 years ago on Monday April 26, 2010 | Permalink
  12. If you place this into your single.php file, it will only show up when there is a custom field called 'Your Likes' or 'Town' included, or just one of them. So if it is just a normal post, or results from a different form, it will not show up.

    <?php if( get_post_meta($post->ID, "likes", true) ): ?>
    <b>Your Likes: </b><?php echo get_post_meta($post->ID, "likes", true); ?><br>
    <?php else: ?>
    <?php endif; ?>
    
    <?php if( get_post_meta($post->ID, "town", true) ): ?>
    <b>Where you live: </b><?php echo get_post_meta($post->ID, "town", true); ?><br>
    <?php else: ?>
    <?php endif; ?>

    Now you have that, you should be ok at doing the rest.

    We are using this for an events calendar on a site about Hampshire.

    Posted 14 years ago on Monday April 26, 2010 | Permalink
  13. flameboyuk
    Member

    Hi Bawta, thank you for the help. It doesn't seem to be working though. When I go to the edit post link in the entries view screen, all that comes up is the title and body(without the custom field info in it). Do I have to include the form ID in place of "ID"? Or could it be that there is somewhere specific I should place it into my single.php? I'll include my single.php in case that helps. I'm sorry for being a bother. Once again, thank you for your help.

    code - http://pastie.org/935659

    Posted 14 years ago on Monday April 26, 2010 | Permalink
  14. Sorry for taking a while to get back to you. I was called in last minute to teach a web design class about WordPress, which is kinda funny (I'm no expert).

    Looking at that code, I would say that it needs to go between line 77 & 78. Try that and see if it works, if not then call me many things under your breath and then come back and I'll take another look at it for you.

    Posted 14 years ago on Monday April 26, 2010 | Permalink
  15. flameboyuk
    Member

    Hi Bawta, I didn't seem to work. I did however refrain from calling you many things under your breath! Is there something I need to add somewhere else? I'm guessing it should just appear in the post body in the post edit screen, right?

    I'm very sorry for taking up so much of your time. I have a long list of things which I'm struggling on at the moment (like trying to generate a page instead of a post) but I'm sure I'll get there in the end. The community around this plugin is excellent thanks to people like you.

    Posted 14 years ago on Tuesday April 27, 2010 | Permalink
  16. I don't mind helping out when I can, I've asked enough questions on here the past week.

    It should go where the post calls the content, or just before it, and it looked like that was the right place. I'm hoping somebody else will see something there that I'm not, but if not, I'll take another look at it for you.

    I read a post on here yesterday that gave a link to creating a page instead of a post. If I can find it again, I'll put the link in here for you.

    Posted 14 years ago on Tuesday April 27, 2010 | Permalink
  17. flameboyuk
    Member

    Okay, thanks Bawta.
    Yeah, creating a new page was part of this post and some pointed me to another but that didn't work for me. No one has got back to me on that one. Oh well, I'll keep my fingers crossed.

    Posted 14 years ago on Tuesday April 27, 2010 | Permalink
  18. I'll take another look for you, but can't promise anything. Like i said, I'm still learning it all myself (as you'll see from some of my own posts).

    Posted 14 years ago on Tuesday April 27, 2010 | Permalink
  19. flameboyuk
    Member

    Thank you. That's good of you. Hopefully someday I'll be able to help somebody out too!

    Posted 14 years ago on Wednesday April 28, 2010 | Permalink
  20. jtcreate
    Member

    Were you able to get this to work? I'm trying to do the same thing. User enters info into form. Form output goes to a page on the site. Each time they add, a new line of results is added to the page. Would love to get this working. Thanks!

    Posted 13 years ago on Wednesday November 10, 2010 | Permalink