PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Custom fields and save value

  1. I create a new custom field, that I can use in form editor, and that I see on forms. But any of this values are saved in entries, and not received in hooks.

    This is the code that I use to create button.

    add_action("gform_field_input", "interes_checkbox", 10, 5);
    
    function interes_checkbox($input, $field, $value, $lead_id, $form_id)
    {
    
    	global $wp;
        if($field["type"] == "custominteres")
        {
        	// mostrara checkboxes en 3 columnes respecte a la taxonomia interes.
        	if(IS_ADMIN)
        	{
        		$input = "Categories taxonomies interés";
        	}
        	else {
    
        	$input = "<div class=\"ginput_container\">\n";
        	$input .= "<ul class=\"gfield_checkbox\" id=\"input_".$field['formId']."_".$field['id']."\">\n";
        	$taxonomies= get_terms('interes','orderby=count&hide_empty=0');
        	$indx_li = 1;
        	foreach ($taxonomies as $ataxo)
        	{
        		$input.="<li class=\"gchoice_".$field['id']."_".$indx_li."\">";
        		$input.="<input name=\"input_".$field['id'].".".$indx_li."\" type=\"checkbox\" value=\"".$ataxo->term_id."\" id=\"choice_".$field['id']."_".$indx_li."\">";
        		$input .= "<label for=\"choice_".$field['id']."_".$indx_li."\">".$ataxo->name."</label>";
        		$input.="</li>";
        		$indx_li++ ;
        	}
        	$input .= "</ul>";
        	$input .= print_r($value,true);
        	$input .= print_r($field,true);
        	$input .= "</div>";
        	}
    
        }
    
        return $input;
    }
    
    function add_clist_field($field_groups){
    
    	// Custom Fields Group
    	$field_groups[] = array(
    		'name' => 'custom_interes',
    		'label' => 'Extras',
    		'fields' => array(
    			array(
    				'class' => 'button',
    				'value' => 'Interes',
    				'onclick' => "StartAddField('custominteres');"
    			)
    		)
    	);
        return $field_groups;
    }
    add_filter("gform_add_field_buttons", "add_clist_field");

    All work correct but not checkbox values saved in entris.

    An if I use this hook, no checkbox retrieved in $entry

    add_action("gform_after_submission", "set_post_content", 10, 2);
    
    function set_post_content($entry, $form){
    
    	$data = print_r($entry,true);
    	$data .= print_r($form,true);
            mail("david@examples.com","Values",$data,"From:info@examples.com");
    
    }

    Where is the problem?

    Posted 12 years ago on Wednesday March 21, 2012 | Permalink