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.

{all_fields} Template

  1. I have a form with a product field and it works great. The only problem is that I don't want the product/quantity/price section show up in my notification email when I use {all_fields}.

    So my question is, what file, in the gravityforms plugin folder, can I edit to change the {all_fields} output?

    I know this is not recommended but, by taking a look at the other questions about this, editing the plugin files seems to be my only option.

    If anybody has a better option, please let me know.

    Thanks.

    Posted 8 years ago on Thursday September 1, 2011 | Permalink
  2. Anybody?

    Posted 8 years ago on Thursday September 1, 2011 | Permalink
  3. If you don't want to use the {all_fields} helper you can craft a notification email of just the fields you want, and you can leave those fields out of the notification. Does that work for you?

    Posted 8 years ago on Friday September 2, 2011 | Permalink
  4. Using that method only gives me the content of the inputted field. I would have to manually add headers or titles and since my form has conditional logic, there would be titles that should not be there.

    If you could tell me what file controls the {all_fields} template, that would be great.

    Thanks.

    Posted 8 years ago on Friday September 2, 2011 | Permalink
  5. I went ahead and tried doing it individually. I'm thinking I could give classes to div tags and use javascript to hide them when they have no content. The only problem is that the class attribute of the divs I have set up don't seem to be there. I have auto formatting turned off.

    Any ideas?

    Posted 8 years ago on Friday September 2, 2011 | Permalink
  6. In your content template, you have classes added to the divs, but those classes are not coming through in the email? Can you post your content template here?

    Also, when will the JavaScript run to hide the content? I'm curious about how you're approaching this.

    I did post something previously that created the email and skipped headings for fields that contained no content.
    http://www.gravityhelp.com/forums/topic/all_fields-is-there-a-way-to-control-how-this-looks-in-an-email#post-31569

    Posted 8 years ago on Friday September 2, 2011 | Permalink
  7. Here is my content template: http://www.pastie.org/2473473

    I was planning to use <script></script> tags to use javascript within the email. Then its a matter of setting the display css property to none through js. I have yet to test this but I realize now this may not work due to conflicts with email clients. I'll test it once I figure out the class attribute problem and post back results.

    I also took a look at the solution you provided and it seems like it would work. The thing is however, I am also creating a post, using the post body field, that is to have the same content as the email. (If there is a hook/filter that can let me edit post content then that would be really helpful)

    Anyway, I still need to figure out the class attribute problem to style the email contents.

    Thanks a bunch for the help.

    Posted 8 years ago on Friday September 2, 2011 | Permalink
  8. I think you will find limited success getting JavaScript and CSS to work like that in all email clients. I think you will have problems with security settings in various places.

    You want the post content and email notification to be the same?

    Finally, in your content template, all those attributes for the div are being stripped? If so, I will try to confirm and see why that is. And to confirm, is this the template for your email message to the user, or your Post body content template?

    Posted 8 years ago on Friday September 2, 2011 | Permalink
  9. Yes I want to set the content of a post the same as the notification email. Its sort of a reservation system I've set up. When someone reserves, gravity forms sends an email to me and creates a post that has all the information, so customers can look it up.

    As for the content template attributes being stripped, yes that is whats happening.

    Here is the output I receive in an email after I fill out the form: http://www.pastie.org/2474114

    Thanks

    Posted 8 years ago on Saturday September 3, 2011 | Permalink
  10. That has not been my experience after filling out a form. The classes I use in the post content template remain. Are you talking about the post content template or the admin email notification (which sort of has it's own content template)? I am talking about the post content template.

    Do you require your visitors to be logged in? If so, what role do they have? Or, is this a multi-site installation?

    Posted 8 years ago on Saturday September 3, 2011 | Permalink
  11. In my last post, I was talking about the email notification content template.

    The post content template seems to be working fine, it keeps the class attributes I have set. The admin email notification template however doesn't.

    I know that the email notifications have a different content template which I have edited as well. I also made sure to turn off auto formatting.

    Just to make sure, the post content template works fine, the problems seems to be the admin email notification template. I am using Gmail as the email client and here is my form: http://woodhavenlimousine.com/online-reservations/

    The form does not require users to be logged in and its not a multi site installation.

    Sorry for the confusion.

    Posted 8 years ago on Saturday September 3, 2011 | Permalink
  12. OK, if the posts are being created properly and your classes remain in the markup there there, how about if we just email the post to you as an admin notification, rather than the built in admin notification. Would that work in your situation?

    Posted 8 years ago on Saturday September 3, 2011 | Permalink
  13. What exactly do you mean by email the post? Would it be a link to the created post or would the email contain the content of the created post?

    If it is the latter (having the email notification content be the same as the post content) then it would work.

    Thanks

    Posted 8 years ago on Saturday September 3, 2011 | Permalink
  14. Yes, I think we can probably send the actual body of the post in an email instead of your admin notification. One problem in that case will be that the classes that exist in your div won't be able to reference the CSS in your stylesheet (since the stylesheet won't be attached to the email.) You'd have to convert to inline styles.

    What was the original problem we were trying to solve again?

    Posted 8 years ago on Saturday September 3, 2011 | Permalink
  15. Alright, sending the body of a post as an email sounds good.

    The original problem I was trying to solve was locating the file which controls the {all_fields} template. I was thinking of adding classes through the template so that I could hide items with css. The {all_fields} template only shows submitted fields so I wouldn't have to worry about extra headers.

    I think your solution of sending an email with the content of the post body seems better.

    Posted 8 years ago on Saturday September 3, 2011 | Permalink
  16. So how exactly would I set up a notification email that contains the content of the created post?

    Posted 8 years ago on Sunday September 4, 2011 | Permalink
  17. shamy1000, I will post something for you on Tuesday 6 September. Sorry for the weekend and holiday delay.

    Posted 8 years ago on Tuesday September 6, 2011 | Permalink
  18. Regarding GMail you said this "I am using Gmail as the email client and here is my form:". I just happened to run across this note about GMail stripping CSS.
    http://www.campaignmonitor.com/blog/post/2038/optimizing-css-presentation-in-html-emails/
    (from 2005 - might be out of date, but seemed interesting)

    Gmail takes the liberty of stripping your styles and, “respectfully,” strips any trace of CSS having been used anywhere in your document. For example, it turned this:

    ‹div id="EmailBox"›
     ‹div id="Box"›
      ‹div id="Title"›
       ‹h1›National Adoption Day‹/h1›
       ‹h2›‹a href="url"›Learn more‹/a›‹/h2›
      ‹/div›
    ‹div id="Sidebar"›
    
    into this:
    
    ‹div›
     ‹div›
      ‹div›
       ‹h1›National Adoption Day‹/h1›
       ‹h2›‹a href="url"›Learn more‹/a›‹/h2›
      ‹/div›
    ‹div›
    Posted 8 years ago on Tuesday September 6, 2011 | Permalink
  19. I just realized that if GMail is stripping the attributes out of your admin notification, GMail is going to strip them from the post you email as well. You will still have to convert to inline CSS or even old HTML tags (font, table, etc.) so you could do that in your admin notification OR your post. Does emailing the post even help in that case?

    Here's another good reference for sending HTML email:
    http://kb.mailchimp.com/article/how-to-code-html-emails/

    Posted 8 years ago on Tuesday September 6, 2011 | Permalink
  20. I read the article you posted, I guess sending the post as an email would be useless.

    http://www.gravityhelp.com/forums/topic/all_fields-is-there-a-way-to-control-how-this-looks-in-an-email#post-31569

    In that case, can the solution above be modified so that it affects certain parts of a submission?
    So for example, if I had a product table, could I use the solution above to just get rid of the price, not the entire product table?

    I was thinking of setting a var equal to the product field and then using str_replace to get rid of the price.

    Thank you

    Posted 8 years ago on Tuesday September 6, 2011 | Permalink
  21. Yes you can do that. Do you need help implementing that?

    This code http://pastie.org/2428578 handled 127 fields like that!

    Posted 8 years ago on Wednesday September 7, 2011 | Permalink
  22. Just wanted to let you know that I got the above method to edit the email the way I want. As for the post, I just used javascript to change it.

    Thanks for the help.

    Posted 8 years ago on Thursday September 8, 2011 | Permalink

This topic has been resolved and has been closed to new replies.