Tips for Using Gravity Forms

, , ,

Inserting the following snippets into your WordPress child themes’ functions.php file will activate some nice effects on Gravity Forms. Read code descriptions for additional details.

 

Gravity Forms Tips

 

/*
** Gravity Forms - Implementing a Read Only Field for the Portfolio Form
** Only applied to an input with a class of gf_readonly
** Only works on one form. Update filter "_2" to match form ID #
*/
add_filter( 'gform_pre_render_2', 'add_readonly_script' );
function add_readonly_script( $form )
{
    echo '<script>jQuery(document).ready(function(){jQuery("li.gf_readonly input").attr("readonly","readonly");});<script>';
    return $form;
}

/*
** Gravity Forms - Enable Label Visibility for Placeholder Only Option
*/
add_filter( 'gform_enable_field_label_visibility_settings', '__return_true' );

 

If this article was helpful please take a moment to like us on Facebook, share this on your social media or buy us a cup of coffee.