wordpressgravity-forms-plugingravityformsadd-filter

GravityForms - List Field with multiple DropDown on entries column - fatal syntax error using recommended snippet


I am trying to use this code (with different choices for the second dropdown) but keep getting a fatal error on line 1: syntax error, unexpected 'set_column2’' (T_STRING), expecting ')'

This my my code:

add_filter( 'gform_column_input_6_22_4’, 'set_column2’, 10, 5 );
function set_column2( $input_info, $field, $column, $value, $form_id ) {
    return array( 'type' => 'select', 'choices' => 'One, Two' );
}

I understand I'm missing a ' (I think?) but I can't understand where? Everything seems complete.


Solution

  • It's the closing ` on set_column2, it's the wrong type of ' ! Be careful when copying and pasting code directly, as sometimes the formatting might be wrong. Most IDEs can colour code your code and that can help highlight when these errors occur (in actual fact Stack Overflow's colour coding code snippets told me immediately where the problem was)