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.

List field column field type

  1. hazel
    Member

    Hi, I'm trying to turn a couple of columns in my list field into drop downs. I found this documentation: http://www.gravityhelp.com/documentation/page/Gform_column_input, but I'm having trouble implementing it.

    Tweaking the example given in the documentation, what I want to add is this:

    <?php
    
    add_filter("gform_column_input_2_1_2", "set_column_input", 10, 5);
    function set_column($input_info, $field, $column, $value, $form_id) {
    	return array("type" => "select", "choices" => "Ewe,Ram");
    }
    ?>

    I've tried placing it in my theme's functions.php file, but haven't had any luck getting it to work (it either does nothing, or creates an error). I suspect it has something to do with a syntax mistake on my part (I'm not very php literate).

    This is what my functions.php file (I'm using a child theme of Vigilance, so this is the Vigilance functions file) looks like before I place anything into it:

    <?php
    //Set language folder and load textdomain
    if (file_exists(STYLESHEETPATH . '/languages' ))
    	$language_folder = (STYLESHEETPATH . '/languages' );
    else
    	$language_folder = (TEMPLATEPATH . '/languages' );
    load_theme_textdomain( 'vigilance', $language_folder);
    
    //Add support for post thumbnails
    if ( function_exists( 'add_theme_support' ) )
    	add_theme_support( 'post-thumbnails' );
    
    //Redirect to theme options page on activation
    if ( is_admin() && isset($_GET['activated'] ) && $pagenow ==	"themes.php" )
    	wp_redirect( 'themes.php?page=vigilance-admin.php' );
    
    // Required functions
    if (is_file(STYLESHEETPATH . '/functions/sidebars.php' ))
    	require_once(STYLESHEETPATH . '/functions/sidebars.php' );
    else
    	require_once(TEMPLATEPATH . '/functions/sidebars.php' );
    
    if (is_file(STYLESHEETPATH . '/functions/comments.php' ))
    	require_once(STYLESHEETPATH . '/functions/comments.php' );
    else
    	require_once(TEMPLATEPATH . '/functions/comments.php' );
    
    if (is_file(STYLESHEETPATH . '/functions/vigilance-extend.php' ))
    	require_once(STYLESHEETPATH . '/functions/vigilance-extend.php' );
    else
    	require_once(TEMPLATEPATH . '/functions/vigilance-extend.php' );
    ?>

    Can you tell me where in this I need to place my gform code (and if I need to change the code any)? Thank you for any help!

    This is the form in question: http://openmic.hazelandwren.com/test-form/

    Posted 11 years ago on Friday April 5, 2013 | Permalink
  2. David Peralty

    Looks correct to me. Just make sure you don't have the <?php and ?> if you are putting it inside of those tags already in your functions.php file. Also, try putting it before all the includes in your file.

    Posted 11 years ago on Friday April 5, 2013 | Permalink
  3. hazel
    Member

    Thanks for the speedy reply!

    Okay, so this is what I changed the functions.php file to:

    <?php
    
    add_filter("gform_column_input_2_1_2", "set_column_input", 10, 5);
    function set_column($input_info, $field, $column, $value, $form_id) {
    	return array("type" => "select", "choices" => "Ewe,Ram");
    }
    
    //Set language folder and load textdomain
    if (file_exists(STYLESHEETPATH . '/languages' ))
    	$language_folder = (STYLESHEETPATH . '/languages' );
    else
    	$language_folder = (TEMPLATEPATH . '/languages' );
    load_theme_textdomain( 'vigilance', $language_folder);
    
    //Add support for post thumbnails
    if ( function_exists( 'add_theme_support' ) )
    	add_theme_support( 'post-thumbnails' );
    
    //Redirect to theme options page on activation
    if ( is_admin() && isset($_GET['activated'] ) && $pagenow ==	"themes.php" )
    	wp_redirect( 'themes.php?page=vigilance-admin.php' );
    
    // Required functions
    if (is_file(STYLESHEETPATH . '/functions/sidebars.php' ))
    	require_once(STYLESHEETPATH . '/functions/sidebars.php' );
    else
    	require_once(TEMPLATEPATH . '/functions/sidebars.php' );
    
    if (is_file(STYLESHEETPATH . '/functions/comments.php' ))
    	require_once(STYLESHEETPATH . '/functions/comments.php' );
    else
    	require_once(TEMPLATEPATH . '/functions/comments.php' );
    
    if (is_file(STYLESHEETPATH . '/functions/vigilance-extend.php' ))
    	require_once(STYLESHEETPATH . '/functions/vigilance-extend.php' );
    else
    	require_once(TEMPLATEPATH . '/functions/vigilance-extend.php' );
    ?>

    But it doesn't seem to have changed anything? (In this instance I'm trying to change the second column under "Animal Information": http://openmic.hazelandwren.com/test-form/)

    Am I missing something?

    Posted 11 years ago on Friday April 5, 2013 | Permalink
  4. David Peralty

    The numbers in it are the form id, field id and column number. Can you confirm that this is form 2, field 1? I know it is column two...

    Posted 11 years ago on Friday April 5, 2013 | Permalink
  5. hazel
    Member

    Sorry, I somehow didn't get an email notification of your reply. Yep, the form is #2, and it's field #1, just double-checked to make sure (I've rearranged my fields and added a bunch of new ones after the fact, so that's why field #1 appears so far down the page).

    Any ideas what might be causing interference? Is my theme just not compatible?

    Posted 11 years ago on Saturday April 6, 2013 | Permalink