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.

Gform field css class - no output

  1. avianex
    Member

    Hi!

    Im trying to add custom CSS clases to my input fields.

    I started to test with the example

    <?php
    add_action("gform_field_css_class", "custom_class", 10, 3);
    function custom_class($classes, $field, $form){
        if($field["type"] == "text"){
            $classes .= " custom_textfield_class";
        }
        return $classes;
    }
    ?>

    Unfortunately I do not get any outpit in the text inputs.
    (I don´t have a live demo, it´s still localhost)

    Are there any more requirements to use this filter?

    Thanks!

    Posted 11 years ago on Sunday June 16, 2013 | Permalink
  2. David Peralty

    You added this to your theme's functions.php file? If you are using a caching plugin, you'll need to clear your cache.

    Posted 11 years ago on Monday June 17, 2013 | Permalink
  3. avianex
    Member

    Thanks for e hint - yes I did, no result. I also tried to specifie the exact form ...
    I don´t have a caching plugin.

    Posted 11 years ago on Monday June 17, 2013 | Permalink
  4. avianex
    Member

    Additionally I´m posting the original output from the server (it´s a standard form, nothing customized):

    <form id="gform_1" action="/wordpress/kontakt/#gf_1" target="gform_ajax_frame_1" enctype="multipart/form-data" method="post">
    	<div class="gform_body">
    		<ul id="gform_fields_1" class="gform_fields top_label description_below">
    			<li id="field_1_1" class="gfield">
    			<label class="gfield_label" for="input_1_1_3">Name</label>
    			<div id="input_1_1" class="ginput_complex ginput_container">
    			<span id="input_1_1_3_container" class="ginput_left">
    			<input id="input_1_1_3" type="text" tabindex="1" value="" name="input_1.3">
    			<label for="input_1_1_3">Vorname</label>
    			</span>
    			<span id="input_1_1_6_container" class="ginput_right">
    			<div class="gf_clear gf_clear_complex"></div>
    			</div>
    			</li>
    			<li id="field_1_2" class="gfield" style="display:none;">
    			<li id="field_1_3" class="gfield">
    			<li id="field_1_4" class="gfield gfield_contains_required" style="display:none;">
    		</ul>
    	</div>
    	<div class="gform_footer top_label">
    </form>
    Posted 11 years ago on Monday June 17, 2013 | Permalink