Viewing 5 replies - 1 through 5 (of 5 total)
  • emirpprime

    (@emirpprime)

    Same here.
    – GF CPT ver 3.0.1
    – GF ver 1.9.4.11

    emirpprime

    (@emirpprime)

    Also on:
    – GF CPT var 4.0 beta 1
    – GF ver 1.9.5

    emirpprime

    (@emirpprime)

    If you’re happy with PHP you can fix it, but it is really hacky…

    I’m using this:

    add_filter( "gform_pre_submission_1", "gf_time_to_cpt" );
    function gf_time_to_cpt( $form ){
        foreach($form["fields"] as &$field)
            if($field["type"] == 'post_custom_field' && $field["inputType"] == 'time'){
                $source = $field['id']; $destination = $source+4;
                $time = rgpost( 'input_'.$source );
                $_POST['input_'.$destination] = sprintf( "%02d:%02d %s", $time[0], $time[1], $time[2] );
            }
        return $form;
    }

    What this does is take the data from the Time field, process it in the same way that GF does, and write it to another field (Hidden one), that successfully mapped to my Custom Post Type.
    It relies on putting your hidden field(s) a known distance away from your Time fields. ‘$destination = $source+4;’ takes the ID of the Time field, and then adds 4 to it to get the ID of the Hidden fields (you would have to change 4 for something else).

    This might get you started on building a work around for your situation.

    Thread Starter mibrenner

    (@mibrenner)

    This is a nice hack but I’m wondering if the core plugin might be updated to handle time variables.

    Bump, please.

    bump.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Time Field Not Saving’ is closed to new replies.