Different Placeholders for Multiple Radio Button Questions

I am currently using:

add_filter( 'gform_other_choice_value', 'set_placeholder', 10, 2 );
function set_placeholder( $placeholder, $field ) {
    return 'XXXXX';

to change the placeholder text of the “Other” option of a radio button question.

However, this snippet changes all the placeholders for all the radio button questions! How can I modify this snippet to only target individual fields?

Thanks in advance!

Hello. The $field object contains the form ID, so you can do something like this (courtesy of @spivurno of GravityWiz):


Perfect, thanks! This works and should be included somewhere in the documentation, if you ask me. :slight_smile:

1 Like

Good point! I’ll recommend it. Thanks to David Smith for that one.