【发布时间】:2014-06-18 09:37:13
【问题描述】:
我正在为重力形式应用 add_filter 寻求帮助。我做了一些研究,发现这个链接http://www.gravityhelp.com/documentation/page/Gform_pre_render 是如何应用自定义过滤器的粗略示例。不幸的是,我没有运气让它工作。我没有收到任何错误。当用户选择一个单选按钮时,非常希望在单选按钮的顶部或底部显示回显文本。
<ul class="gfield_radio" id="input_7_16">
<li class="gchoice_16_0">
<input name="input_16" type="radio" value="Plan 180" id="choice_16_0" tabindex="1">
<label for="choice_16_0" id="label_16_0">Op1</label>
</li>
<li class="gchoice_16_1">
<input name="input_16" type="radio" value="Plan 420" id="choice_16_1" tabindex="2">
<label for="choice_16_1" id="label_16_1">Op2</label>
</li>
<li class="gchoice_16_2">
<input name="input_16" type="radio" value="Plan 560" id="choice_16_2" tabindex="3">
<label for="choice_16_2" id="label_16_2">Op3</label><
/li>
</ul>
重力形式添加滤镜
add_filter('gform_pre_render_6', 'populate_text');
function populate_text($form){
if ($field["id"] == choice_16_0) {
echo '<br/>Your start date is Saturday ' , getStartSat();
}
else if ($field["id"] == choice_16_1 ) {
echo '<br/>Your start date is Monday ' , getStartMon();
}
else if ($field["id"] == choice_16_2 ) {
echo '<br/>Your start date is Saturday ' , getStartSat(), 'or <br/> Monday ' , getStartMon();
}
return $form;
}
【问题讨论】:
标签: php wordpress gravity-forms-plugin