Hello there,
I added a new field using gform_field_input. This field output a facebook LIKE box.
Everything works fine until the validation.
The LIKE box disappear and I would like it to stay on the page.
Could you please advice me on how I could fix this problem ?
Here is my code for adding the new field :
add_action("gform_field_input", "facebooklike_input", 10, 5);
function facebooklike_input($input, $field, $value, $lead_id, $form_id){
if($field["type"] == "facebook-like"){
$input = '';
if (sfc_is_fan()) { // Function developed by Simple Facebook Connect by Otto.
$input .= 'You LIKE us on Facebook, your chances are doubled.';
} else {
$input .= 'To double your chance to win, LIKE us on Facebook.';
}
}
return $input;
}
add_filter("gform_add_field_buttons", "add_facebooklike_field");
function add_facebooklike_field($field_groups){
foreach($field_groups as $group){
if($group["name"] == "advanced_fields"){
$group["fields"][] = array("class"=>"button", "value" => "Facebook Like it !", "onclick" => "StartAddField('facebook-like');");
break;
}
}
return $field_groups;
}