2014-09-19 55 views
0

In Gravity Forms插件我試圖根據開始日期和開始時間值動態填充結束日期和結束時間,但沒有運氣。根據開始日期動態填充重力形式

這是我用來動態填充結束日期代碼:

<?php 
add_filter("gform_field_value_date", "populate_date"); 
function populate_date($value){ 
return date('Y-m-d', strtotime('+0 days')); 
} 
?> 

其實,這工作,但它增加了「0天」的提交日期,而不是「開始日期」值。

隨着時間的推移。我想讓「結束時間」字段自動填充,即結束時間=開始時間。我想將「+1小時」添加到「開始時間」,從而得到「結束時間」。

有什麼建議嗎? TNX

回答

1

下面是日期位的解決方案:

http://gravitywiz.com/populate-dates-gravity-form-fields/

你的使用情況會是這個樣子:

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 
)); 

什麼樣的時間字段配置您使用的是?有一個鏈接到你的表單?

相關問題