Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author ovann86

    (@ovann86)

    Hi,

    “Select an Option” is the default text that the Chosen plugin (what Gravity Forms uses for the enhanced drop down) displays when no value is selected.

    To change this you’ll need to use the Gravity Forms JavaScript filter.

    Example below:

    add_action("gform_pre_render", "set_chosen_options");
    function set_chosen_options($form){
        ?>
    
        <script type="text/javascript">
            gform.addFilter('gform_chosen_options','set_chosen_options_js');
            //limit how many options may be chosen in a multi-select to 2
            function set_chosen_options_js(options, element){
                //form id = 85, field id = 5
                //if (element.attr('id') == 'input_2_3'){
                    options.placeholder_text_single = 'Select an option';
                //}
    
                return options;
            }
        </script>
    
        <?php
        //return the form object from the php hook
        return $form;
    }
    Thread Starter Md Akter Hosen

    (@tareqhi)

    Thanks a lot, this helps!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Changing "Select an Option" text’ is closed to new replies.