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.

merge field for submission only shows date, not time?

  1. f_devocht
    Member

    I would like to use a merge field to fill out the submission date of the previous form.
    I can use {date_dmy} for this, but I also need the time.
    How can I fill out the time? The time is there in the excell export, so surely I must be able to use it as a merg field?

    Posted 11 years ago on Sunday December 9, 2012 | Permalink
  2. f_devocht
    Member

    I looked in the forum for a solution but didn't find one. Lots of hints though.
    So this is how I solved it.
    I solved it by putting a hidden field on the first form (in my case the field ID = 41 and form ID = 4).
    I then added this code to functions.php:

    add_action("gform_pre_submission_4", "pre_submission_handler");   //4 is the ID of my form
    function pre_submission_handler($form){
    $_POST["input_41"] = date('d/m/Y  |  H:i:s');    // 41 is the ID of my hidden field
    }

    On form submission, field 41 is filled with the submission date and time.
    A confirmation text message asks the user if he wants to fill it out again, with the url to the 2nd form.
    This url has the merg tag of field 41 in it (amongst others), so it is sumitted to the 2nd form.

    In that 2nd form (a duplicate of the first form with an extra id for the previous submission date), I'm dynamically filling that submission date I had in the 1st form.

    This works great.

    Posted 11 years ago on Sunday December 9, 2012 | Permalink
  3. David Peralty

    That's a perfect solution, and exactly what I was going to write when I was reading through your problem. Kudos!

    Posted 11 years ago on Monday December 10, 2012 | Permalink