• Resolved spacemakerman

    (@spacemakerman)


    Hello!
    Please tell me how to exclude the first value in the drop-down menu from the selection (for example, when it is a preset value).

    <option value="" disabled selected>preset value</option>

    Thank you in advance for your answer.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author CodePeople2

    (@codepeople2)

    Hello @spacemakerman

    Thank you so much for using our plugin.

    If you want to include a “preset value” option, first enter all selectable options in DropDown settings, tick the “Includes an additional first choice as placeholder” checkbox and enter “preset value” through the “First choice text” attribute.

    Best regards.

    Thread Starter spacemakerman

    (@spacemakerman)

    Thank you, I’m talking about something else. I need the preset value to be unselectable.

    I found a solution via a script and adding a class:

    <script>

    jQuery(function($) {
    $('div.my_dropdown_1 select').each(function() {
    var $select = $(this);
    var $firstOption = $select.find('option[value=""]');
    $firstOption.prop('disabled', true).prop('selected', true);
    $select.find('option').not($firstOption).removeAttr('selected');
    });
    });

    </script>

    demo page: https://spacemakerman.s1-tastewp.com/?cff-form=9

    But maybe there are some CFF settings I don’t know about, or a better solution?

    Plugin Author CodePeople2

    (@codepeople2)

    Hello @spacemakerman

    If you want to deactivate the choice from user selection, you must use JS. However, I prefer using the following piece of code:


    <script>
    fbuilderjQuery(document).on('formReady', function(){
    getField('fieldname1').jQueryRef().find('option:eq(0)').prop('disabled', true);
    });
    </script>

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.