I am trying to populate address and time field in gravity forms. The following code does only work for normal fields but sadly not for address and time fields. What am I doing wrong? Any advices? Sadly there is no documentation about how to populate date or adress fields. Field 3 is a time field. Field 27 adress fields.
foreach($form["fields"] as &$field)
switch($field["id"])
{
case "26": $field["defaultValue"] = $global_turnier_id; break;
case "1": $field["defaultValue"] = $turnier_name; break;
case "27.1": $field["defaultValue"] = $street; break; //--> not working
case "3.1": $field["defaultValue"] = "12:00:00"; break; //--> not working
You're better off using the gform_field_value
filter as described here:
https://docs.gravityforms.com/using-dynamic-population/#hooks
Might look something like this where "my_time" is the dynamic population parameter set on your time field.
add_filter( 'gform_field_value_my_time', 'dyn_pop_my_time' );
function dyn_pop_my_time( $value ) {
return '12:00';
}