以重力形式动态自动填充事件位置

问题描述 投票:0回答:0

我们的组织有一个标准的重力表,供人们注册我们提供的研讨会。网站是通过 WordPress 建立的

每个页面/帖子都有根据我们在 WP 中输入的内容列出的位置和日期详细信息:

Example of location and date listing

The section where we enter this data in WP

这是我检查该部分以在 WP 中输入帖子的位置和日期时可以看到的内容:

Inspect of the section where we enter this data in WP

表格中第一个问题是“Please enter Location and Date you are applicable for:”,需要填写表格:

Field for user to enter Location and Date of workshop in form

有必要将此信息作为用户注册的一部分进行捕获,但我希望自动填写此信息,因为 1. 它为用户节省了精力/麻烦,以及 2. 用户的一致性绝对为零将输入此信息...

我不知道如何实现这一点(我对 html / php / WP 的经验有限)...

我尝试在默认值等中使用 {embed_post:location} 或 {custom_field:location} 的变体,还尝试对以下代码进行一些编辑:

// Dynamically Autofill Workshop Location

add_filter( 'gform_field_value_event_location', 'event_location_population_function' );
function event_location_population_function( $value ) {
    return $location;
}

...但是我找不到任何有效的方法(或者我只是错误地实现了它)来自动填充表单字段中的数据,而且在这个阶段我真的只是在黑暗中跌跌撞撞...... 😀

如果有人有任何建议或建议,将不胜感激!

谢谢!

forms post dynamic autofill gravity
© www.soinside.com 2019 - 2024. All rights reserved.