【问题标题】:Dynamically Populate Gravity Forms Based on Start Date根据开始日期动态填充重力形式
【发布时间】:2014-09-19 15:24:04
【问题描述】:

在 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 小时”,从而得到“结束时间”。

有什么建议吗? 天呐

【问题讨论】:

    标签: php wordpress gravity-forms-plugin


    【解决方案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
    ) );
    

    您使用的是哪种时间字段配置?有指向您的表单的链接吗?

    【讨论】:

      猜你喜欢
      • 2019-07-13
      • 2014-01-29
      • 1970-01-01
      • 2021-06-05
      • 2016-02-19
      • 1970-01-01
      • 2017-12-23
      • 2017-05-09
      • 2018-05-18
      相关资源
      最近更新 更多