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.

Format of admin email results

  1. Hi, Is there anyway to format the admin email?... I mean the email that gets sent with all the data from the form. I would like to get rid of the blue table color and lineup the field name with the responses (instead of having it under). This would make viewing easier and use less paper when printed.

    Any coding changes would be helpful.

    Posted 15 years ago on Monday November 23, 2009 | Permalink
  2. Currently there is no way to modify the default output using the ALL FIELDS variable.

    However, you can create your own markup and manually add the fields you want displayed instead of using the ALL FIELDS variable. This gives you complete control over the output.

    Posted 15 years ago on Monday November 23, 2009 | Permalink
  3. Thanks Carl, I have no idea how to "create my own markup" though.

    Posted 15 years ago on Monday November 23, 2009 | Permalink
  4. Fred, here's a quick example of formatting an email manually. This is just a simple table with 2 columns, labels on the left like you mentioned. You'll need to replace the field 'tokens' (bracketed content) with the actual field names from your form or it won't work for you. You'll do this by selecting it to insert from the drop down list above the notification field.

    <table cellpadding="5" cellspacing="0" style="border-collapse: collapse">
    
    <tr style="background-color:gray">
    	<td width="25%"><strong>Name</strong></td>
    	<td>{Name (First):2.3} {Name (Last):2.6}</td>
    </tr><!-- end first row -->
    
    <tr style="background-color:white">
    	<td width="25%"><strong>Email</strong></td>
    	<td>{Email:4}</td>
    </tr><!-- end second row -->
    
    <tr style="background-color:gray">
    	<td width="25%"><strong>Address</strong></td>
    	<td>{Address (Street Address):3.1}<br />{Address (Address Line 2):3.2}<br />{Address (City):3.3}, {Address (State / Province):3.4} {Address (Zip / Postal Code):3.5}</td>
    </tr><!-- end third row -->
    
    <tr style="background-color:white">
    	<td width="25%"><strong>Phone Number</strong></td>
    	<td>{Phone:6}</td>
    </tr><!-- end fourth row -->
    
    <tr style="background-color:gray">
    	<td width="25%"><strong>Comments</strong></td>
    	<td>{Comments:15}</td>
    </tr><!-- end fifth row -->
    
    </table>

    I would keep the styling pretty simple as HTML support for email clients varies quite a bit.. what might render well in gmail may not look anywhere near the same in Outlook.

    Posted 15 years ago on Monday November 23, 2009 | Permalink
  5. You can also do it the (much) easier way:

    Name: {Name (First):1.3} {Name (Last):1.6}
    Email: {Email:2}
    Address: {Address (Street Address):3.1}, {Address (City):3.3}, {Address (State / Province):3.4}, {Address (Zip / Postal Code):3.5}
    Phone: {Phone:4}
    Student ID: {Student ID:5}
    Instructors Name: {Instructors Name:6}
    Status: {Status:29}

    Just type your prefix out and use the drop down to insert the appropriate field where you want it to display. It's by far the simplest way to do what you're talking about.

    Posted 15 years ago on Tuesday November 24, 2009 | Permalink
  6. Thanks for posting, but the problem with these methods is that I use a form with has numerous conditions. So the "all fields" is best. I wish I can have it default to how you have it Shelley. There must be a way to change the code settings for the "all fields", no?

    Posted 15 years ago on Tuesday November 24, 2009 | Permalink
  7. Fred,

    You could certainly modify the plugin files themselves to change the output. However, you would have to take great care in maintaining this going forward.

    When we release an update to the plugin, you would have to be sure to merge your changes with the updated plugin files. The upgrade process will overwrite the existing plugin files, and your changes and you will need to re-apply your changes.

    If this is planned and managed properly it is certainly doable.

    If you have a developer that can maintain this for you, we can certainly point him in the right direction.

    Posted 15 years ago on Tuesday November 24, 2009 | Permalink
  8. Hi, I can manage it myself if I knew what file to modify and the code needed to change it.

    Posted 15 years ago on Tuesday November 24, 2009 | Permalink
  9. Hey Fred, this code is located here:

    File: common.php
    Function: get_submitted_fields() function

    Just be aware, any changes you make will be overwritten by upgrades so keep a log of what changes you make so you can re-apply them.

    We strongly recommend you stay up to date with the latest version of Gravity Forms as they are released, so don't avoid upgrades due to custom code you have added.

    Posted 15 years ago on Tuesday November 24, 2009 | Permalink
  10. I'm also trying to figure out how to style my email results. I understand that I'd have to re-apply the changes as upgrades are released, but I'm cool with that. My end goal is something similar to this, which is what I have right now with cforms.

    What I'm having trouble with is 1) figuring out which part of common.php to replace with my custom code. I see get_submitted_fields() on line 373, but the table seems to be interlaced with a lot of php code. Also 2) I can't find anything in my Gravity admin panel that looks anything like Kevin's screenshot above. Where is that located?

    Tons of thanks in advance!

    Posted 14 years ago on Wednesday May 5, 2010 | Permalink
  11. I think you are making this harder than it needs. You can completely configure your email without having to touch a line of PHP. What you need to do is go to the Notification page. You can get to the notification page by clicking the "Notifications" link when mousing over a form in the form list screen.

    Posted 14 years ago on Wednesday May 5, 2010 | Permalink
  12. Ah, right you are! Thank you very much for both responses today. That page was eluding me, but after toying with it I've got it almost perfect.

    My (hopefully) final question is this: is there any way to get the responses on the right to have their left sides all aligned and flushed together?

    Here's what I want.

    Here's what I've got.

    Posted 14 years ago on Wednesday May 5, 2010 | Permalink
  13. It looks like you will need to put your fields in a table and define some widths/cellpadding.. the label in one < td> and the value in the next.. something like this

    <table cellpadding="4" cellspacing="0">
    <tr>
    <td width="20%">City:</td>
    <td width="80%">{Address (City):3.3}:</td>
    </tr>
    </table>

    A simple table is going to work better in most email clients than any fancy CSS so I suggest going that way.

    Posted 14 years ago on Thursday May 6, 2010 | Permalink
  14. I have client that has the same requirements as the ones Fred Romano above does.
    If I place the fields one by one in an html table, then it will display text for empty fields too. There is only conditional checking on the all_fields tag.

    Therefore, I also request that there be a way to style the all_fields notifications email, without having to hack the plugin code.

    Thanks
    Vayu

    Posted 13 years ago on Wednesday August 17, 2011 | Permalink
  15. Here's a way to do it without hacking the plugin code:

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

    If you have any questions please let us know.

    Posted 13 years ago on Wednesday August 17, 2011 | Permalink

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