如何从重力表单条目对象中获取复选框的值?
This seems like it should be a fairly easy question, but Google is not yielding results.
I'm writing a WordPress plugin that processes data from Gravity Forms after the submission is complete. I'm using the gform_after_submission
hook.
This passes an "Entry Object" to my function for processing. Most of the values I can extract just fine. So for example:
$eventDate = $e[2];
...Works just fine. This is a date field. All I have to do is pull the value out of the entry object with the proper index.
My issue is getting the value of a particular checkbox. I need to see if it was checked or not.
This doesn't work:
$checkbox = $e[4];
I'm guessing it's because a checkbox field can have multiple values. Unfortunately I'm not sure how to get to the value of each specific checkbox.
Thank you in advance for your help!
这似乎应该是一个相当简单的问题,但谷歌并没有产生结果。 p>
我正在编写一个WordPress插件,在提交完成后处理来自Gravity Forms的数据。 我正在使用 这会将“Entry Object”传递给我的函数进行处理。 我能提取的大多数值都很好。 例如: p>
...工作正常。 这是一个日期字段。 我所要做的就是使用适当的索引从入口对象中提取值。 p>
我的问题是获取特定复选框的值。 我需要查看它是否被检查过。 p>
这不起作用: p>
我猜这是因为复选框字段可以有多个值。 不幸的是,我不确定如何获得每个特定复选框的值。 p>
提前感谢您的帮助! p>
div> gform_after_submission code>钩子。 p>
$ eventDate = $ e [2]; code> p>
$ checkbox = $ e [4] ; code> p>
If no checkbox value is set manually, the variable will have the value "on". Please do a var_dump($e); and post the result.