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.

Limiting gform_field_choices by form parameter?

  1. Using the gform_field_css_class action I am able to ensure that the following logic only gets executed against a particular form by CSS class on the form. I'm distributing the form for others to import, so cannot use the form # since it changes per import / site.

    add_action("gform_field_css_class", "class_silent"), 10, 3);
    function class_silent($classes, $field, $form){
    		$auctionFormType = strpos($form['cssClass'], 'idealien_auctions');
    		if( $auctionFormType === false )
    			return $classes;
    
    		if($field['inputName'] == "displayName"){
            	$classes .= " hidden ";
        	}
        return $classes;
    	}

    The parameters for gform_field_choices filter does not include $form to do the same logic. Is there another recommended approach to ensure the modification to choices does not occur outside of the intended form?

    Posted 8 years ago on Friday September 28, 2012 | Permalink