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.

gform_pre_submission hook not saving data

  1. HI there,

    I'm trying to use the gform_pre_submission hook to convert a date field into a different format.

    I'm using the following:

    add_action("gform_pre_submission", "pre_submission_handler", 10, 2);
    
    function pre_submission_handler($form){
        date_default_timezone_set('UTC');
        $date = $_POST["input_4"];
        $date = date('l jS M', strtotime($date));
        $_POST["input_4"] = $date;
        die(var_dump($_POST));
    }

    When I perform a vardump of the $_POST variable it gives the right info:

    ["input_4"]=> string(17) "Saturday 29th Jun"

    but it doesn't seem to save it. In the entries page the Date column is left blank.

    Any thoughts?

    Posted 5 years ago on Wednesday June 26, 2013 | Permalink
  2. David Peralty
    Administrator

    It won't save because that field is set-up for a specific data type. If you tried to save your new date value in a hidden text field, it would work because that field would accept any values.

    Posted 5 years ago on Wednesday June 26, 2013 | Permalink
  3. Ahh ok cheers David - got it working!

    Posted 5 years ago on Thursday June 27, 2013 | Permalink

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