Alex I tried the modification but didn't work. there still might be a date format problem.
currently in my form the form number is 3, the date number is 28, the input date type is "date field" the date format is "dd/mm/yyyy"
so I inserted in the following text in function.php :
add_filter("gform_post_data", "change_post_date", 10, 3);
function change_post_date($post_data, $form, $entry){
//Only change post date on form id 124.
//NOTE: Replace 124 with your actual form id
if($form["id"] != 3)
return $post_data;
//NOTE: Replace 3 with your date field id. You can find your field id by inspecting the field's input tag
$post_data["post_date"] = $entry["28.3"] . "-" . $entry["28.2"] . "-" . $entry["28.1"];
return $post_data;
}
the result is that the posts are sent a today date. not working.
here is the code of the form for the date input:
<label class='gfield_label' for='input_3_28'>Date</label><div class='clear-multi'><div class='gfield_date_day ginput_container' id='input_3_28'><input type='text' maxlength='2' name='input_28[]' id='input_3_28.2' value='' tabindex='2' /><label for='input_3_28.2'>DD</label></div><div class='gfield_date_month ginput_container' id='input_3_28'><input type='text' maxlength='2' name='input_28[]' id='input_3_28.1' value='' tabindex='3' /><label for='input_3_28.1'>MM</label></div><div class='gfield_date_year ginput_container' id='input_3_28'><input type='text' maxlength='4' name='input_28[]' id='input_3_28.3' value='' tabindex='4' /><label for='input_3_28.3'>YYYY</label></div>
the other thing is that I will have several gravity forms which should send post with a user modified date.
so What would be the code for several forms and Date Input Type, date picker, calendar, dd/mm/yyyy?
Posted 13 years ago on Sunday January 30, 2011 |
Permalink