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.

Can one hide the post body field from the form on the front end of a site?

  1. RichardBest
    Member

    Hi there - I'm experimenting with a particular use of Gravity Forms, by which I'm:

    • using a GF form to enable people to create posts from the front end; and
    • adding default text into the post body.

    There is no need (nor is it desirable) for those creating the posts to see the post body field within the form when they enter other details. Is there any way of hiding that please, for all instances of that particular form, so users don't see that field (i.e., so the users don't see it but the default text still forms the post body as normal)?

    Many thanks
    Richard

    Posted 9 years ago on Sunday May 2, 2010 | Permalink
  2. Instead of making the default text part of the form, why not make it part of the post template? That way it doesn't need to be part of the form and you don't have to worry about hiding it.

    Posted 9 years ago on Sunday May 2, 2010 | Permalink
  3. RichardBest
    Member

    Thanks for the idea, but from memory, using the post template technique will result in a post submission where not all of the post data will go into the database tables, given that each post is dependent on the 'post template content' as opposed to 'real post content', if that makes sense.

    Posted 9 years ago on Sunday May 2, 2010 | Permalink
  4. If you don't want to go with the post template, Alex posted recently about prepending some text to the form submission.

    http://forum.gravityhelp.com/topic/insert-shortcode-in-post-body#post-5119

    If you can prepend or append the text to the submission, then this would work. If you need your standard text in the middle of the submitted form data, this would not work so simply.

    Posted 9 years ago on Monday May 3, 2010 | Permalink
  5. RichardBest
    Member

    Thanks. Good idea. I'm still keen to know whether the GF team can suggest another solution by which I can hide the post body field though...

    Posted 9 years ago on Monday May 3, 2010 | Permalink
  6. Richard,
    In order to create a post, GF requires that a form has a post title or a post body field. If your form has the post title field, you can just remove the post body from the form. If post body is your only post field, you will need to keep it. What you can do is hide it with jQuery. If that is acceptable, send me a link to your form and I will give you a code snippet to hide the field.

    Posted 9 years ago on Monday May 3, 2010 | Permalink
  7. RichardBest
    Member

    Hi Alex

    The jQuery technique sounds perfect. I've not built the form yet as I was keen first to know whether this was possible. Is there any chance you could post the jQuery here please and tell me where to put it? I should be able to sort it out.

    Thanks for your help
    Richard

    Posted 9 years ago on Monday May 3, 2010 | Permalink
  8. Richard,
    Actually, this can be done with CSS. You need to do the following:

    1- In your post body field editor, enter a Css Class Name in the advanced tab
    (i.e. post_body_hidden)

    2- Add the following line of code to your theme's style.css
    .post_body_hidden{display:none}

    Let me know if you have issues with it.

    Posted 9 years ago on Tuesday May 4, 2010 | Permalink
  9. RichardBest
    Member

    Superb. Thanks Alex. Will try this out tonight. Richard.

    Posted 9 years ago on Tuesday May 4, 2010 | Permalink
  10. RichardBest
    Member

    Hi Alex - This worked perfectly! Awesome, thanks.

    Posted 9 years ago on Tuesday May 4, 2010 | Permalink
  11. Great!

    Posted 9 years ago on Tuesday May 4, 2010 | Permalink
  12. This is what I don't get with the Post Body Template thing. If I'm using the Template feature, why is the body field visible at all in the first place? Whatever the user inputs in the field gets overridden (in the generated post) by the contents of the template anyway. Is there a way to generate the contents of the post without the need for the body field? Like with a hook or something?

    Posted 8 years ago on Tuesday November 16, 2010 | Permalink
  13. @danielck Because some people still want to use the Post Body field for the main Post Body content and then insert other field values, primarily Post Image content into the body of the post. But with the Content Template you have complete control so you have to tell it to insert the value of that field. What we will probably do is default the Content Template so by default it has the form field variable for the Post Body field pre-populated.

    Posted 8 years ago on Tuesday November 16, 2010 | Permalink