In Gravity Forms plugin I've tried to dynamically populate End Date and End Time based on the Start Date and Start Time values but no luck.
This is the code I used to dynamically populate End Date:
<?php
add_filter("gform_field_value_date", "populate_date");
function populate_date($value){
return date('Y-m-d', strtotime('+0 days'));
}
?>
This actually works but it adds '+0 days' to the submission date and not to the 'Start Date' value.
Same goes with time. I want to have the ‘End Time’ field auto-populated, i.e. End Time = Start Time. And I want to add “+1 hour” to the ‘Start Time’ and thus get ‘End Time’.
Any suggestions? Tnx
Here's a solution for the Date bit:
http://gravitywiz.com/populate-dates-gravity-form-fields/
Your use case would look something like this:
new GW_Populate_Date( array(
'form_id' => 1, // update to your form ID
'target_field_id' => 1, // update to the ID of the 'End Date' field
'source_field_id' => 2 // update to the ID of the 'Start Date' field
) );
What kind of Time field configuration are you using? Got a link to your form?