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.

Add class to input using php - not client side

  1. Hello,

    I am trying to simple add class to input element so I can use bootstrap classes etc. But I don't want to use javascript because it takes to long to fire depending on the page load.

    So I am trying to achieve it with php. But I can only seem to add classes to the input container. Which is not helping my bootstrap integration.

    I am using less for all the style adjustments that work beautifully with gravity forms.

    It's just that I would like to customise the input size across different forms, and add classes to the inputs. I know I could use this code below and add another style to the bootstrap.

    // ADD CLASS TO SIDEBAR INPUTS
    add_action("gform_field_css_class", "sidebar_custom_class", 10, 3);
    function sidebar_custom_class($classes, $field, $form){
    	if($form["id"] == 2 && $field["type"] == "text"){
    		$classes .= " input-block-level";
    	}
        return $classes;
    }

    I'm curious if I can add classes to inputs directly to save the hassle of adding more styles.

    Thanks

    Posted 10 years ago on Monday June 24, 2013 | Permalink
  2. Richard Vav
    Administrator

    If you still require assistance with this please open a new support ticket or a priority support ticket if you are a developer license holder. Thank you.

    Posted 10 years ago on Sunday July 28, 2013 | Permalink

This topic has been resolved and has been closed to new replies.