0
votes

I'm looking for some assistance at applying a add_filter for Gravity Forms. I've done some research and found this link http://www.gravityhelp.com/documentation/page/Gform_pre_render a rough example of how to apply a custom filter. Unfortunately I've had no luck getting it to work. I'm not receiving any errors. Pretty much want to display the echo'd text at the top or bottom of the radio button when the user select one.

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

Gravity Form add filter

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; 
}
1

1 Answers

-1
votes

Are you actually submitting the forms? Pre Render is Data that is getting Pre Render before the form is getting loaded and than loading the 'Pre Render' info. Works really well with multiple forms and/or custom DB queries.

A mix of Conditional Logic & Text fields will take care of that for you if your not submitting anything. There is dozens of methods to echo text in Gravity Forms.