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.

Placeholders issue

  1. cmccrone

    Im using the placeholders plugin listed below and I have found two problems.

    1 ) It erases/hides the text next to the radio, checkboxes etc
    2 ) When I created a paged form, it doesn't add the placeholders to the other pages (2nd, 3rd, etc). Just the first page of the form before you hit next.

    Anything wrong in this code that can fix those issues?


    function gfap_load_scripts() {
    	wp_register_script('modernizr', '', array('jquery'));
    add_action('wp_enqueue_scripts', 'gfap_load_scripts');
    function register_gfap_settings() {
    	$setting_vars = array(
    	foreach ( $setting_vars as $setting_var ){
    		register_setting( 'gfap_mystery', $setting_var );
    add_action( 'admin_init', 'register_gfap_settings' );
    function gfap_menu() {
    	add_options_page( 'Gravity Forms Auto Placeholders Settings', 'Gravity Forms Auto Placeholders', 'manage_options', 'gfap_uid', 'gfap_options' );
    function gfap_options() {
    	if ( !current_user_can( 'manage_options' ) )  {
    		wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
    	echo '<div class="wrap"><h2>Gravity Forms Auto Placeholders Settings</h2><form method="post" action="options.php">';
    <style>.wrap form td span{color:#888;} .wrap legend{font-size:13px; font-weight:bold; margin-left:-5px;} .wrap fieldset{margin:10px 0px; padding:15px; padding-top:0px; border:1px solid #ccc;}</style>
    	<legend>Convert labels to placeholders:</legend>
    	<table class="form-table">
    		<tr><td><input type="checkbox" name="gfap_class" value="1" <?php checked( '1', get_option( 'gfap_class' ) ); ?> /> Only on forms or form items with the class <b><i>gfap_placeholder</b></i> <span>- By default, leaving this unchecked will apply the effect to all Gravity Forms</span></td></tr>
    <p class="submit">
    <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
    	echo '</form></div>';
    add_action( 'admin_menu', 'gfap_menu' );
    function gfap_script() { ?>
    // Start allowance of jQuery to $ shortcut
    	// Convert label to placeholder
    		$gfap_class_pc = get_option('gfap_class');
    		if ($gfap_class_pc) {
    			$gfap_class = 'gfap_placeholder';
    		else {
    			$gfap_class = 'gform_wrapper';
    	$.each($('.<?php echo $gfap_class; ?> input, .<?php echo $gfap_class; ?> textarea'), function () {
    		var gfapId =;
    		var gfapLabel = $('label[for=' + gfapId + ']');
    		var gfapLabelValue = $(gfapLabel).text();
    	// Use modernizr to add placeholders for IE
    	if(!Modernizr.input.placeholder){$("input,textarea").each(function(){if($(this).val()=="" && $(this).attr("placeholder")!=""){$(this).val($(this).attr("placeholder"));$(this).focus(function(){if($(this).val()==$(this).attr("placeholder")) $(this).val("");});$(this).blur(function(){if($(this).val()=="") $(this).val($(this).attr("placeholder"));});}});}
    // Ends allowance of jQuery to $ shortcut
    add_action('wp_head', 'gfap_script');

    Thanks to everyone that helps me out! Appreciate it!

    Posted 11 years ago on Friday August 24, 2012 | Permalink
  2. That placeholder plugin was not created by Gravity Forms and I'm unfamiliar with it. Please contact that plugin author for their support.

    We'll leave this ticket open in case you need assistance with Gravity Forms and not this 3rd party plugin. Thanks.

    UPDATE: I see you started a topic there already. Please let us know what you find out.

    Posted 11 years ago on Friday August 24, 2012 | Permalink
  3. cmccrone

    Will do :)

    Posted 11 years ago on Friday August 24, 2012 | Permalink
  4. cmccrone

    @Chris I doubt the guy is going to respond any time soon. Whats is the most simple way to do this? I have some long application forms and they look AMAZING with placeholders vs titles above the input.

    I don't know where to begin.

    Thanks Chris

    Posted 11 years ago on Friday August 24, 2012 | Permalink
  5. If the jQuery is working on page 1 of the form but not subsequent pages, chances are you need to add the script to subsequent pages yourself. Please see this

    Posted 11 years ago on Saturday August 25, 2012 | Permalink