We use cookies to keep our site relevant and easy to use, your continued use of this site is consent that we may set several cookies (see our Privacy & Cookie Policy), click to always allow cookies from our site (and not see this notifcation on your next visit) or read more.Allow Cookies

EU legislation requires that all websites clearly specify if cookies are being used and their purpose, You can read more about how we use cookies (and which cookies we use) in our Privacy and Cookie Policy.

You will see this notification the first time you visit our website unless you accept cookies (in which case we'll set a cookie to remember thay you're happy for us to to set cookies!).

Gravity Forms: Submission Timestamp

We recently purchased Gravity Forms for doing some client projects and it’s fantastic…

I thought I’d got everything I need but there was one thing it didn’t do that really surprised me, in the notification emails there was no way of getting the exact time the submission button was hit! This really surprised me, this seems like one of the most obvious things you’d want to know.

Support were fantastic and answered my query in just a few minutes, it has to be done with a hook (this still surprises me!), so here you go:

  • First create a hidden field in your form, we’ll use a hook to fill this in after submission.
  • Add the following to your functions.php
    function add_timestamp($form ) {
    // Add the timestamp
    // Replace input_9 with your hidden field and
    // date('r') with your chosen timestamp format
    $_POST["input_9"] = date('r'); 
    }
    // Modify form 3 (set to gform_pre_submission to apply to all forms)
    add_action("gform_pre_submission_3", "add_timestamp", 10, 2);

This entry was posted on Wednesday, February 19th, 2014 at 8:58 am and is filed under PHP. You can follow any responses to this entry through the RSS 2.0 feed.