• Resolved mrmet86

    (@mrmet86)


    Hello, I am looking to add “Select” as the first drop down option but I don’t know how to disable it from being selected. I see the optgroup option, which does disable the option but then, it is not displayed on the drop down as the initial selection.

    Please let me know if it’s possible to display “Select” on a drop down menu while not being able to be selected. Thank you.

    https://imgur.com/yVTFxV8

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @mrmet86

    Thank you so much for using our plugin. Please follow the instructions below.

    Go to the DropDown field’s settings, tick the “Includes an additional first choice as placeholder” checkbox, and enter the text of first choice through the “First choice text” attribute.

    Assuming the DropDown field is the fieldname123, insert an “HTML Content” field in the form and enter the following piece of code as its content:

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

    Best regards.

    Thread Starter mrmet86

    (@mrmet86)

    Hello again. Is it possible to target the specific form and field name? This does not work when two forms are being used on the same page. I recreated the field with an id that is not used on the first form but this did not work either. (first form does calculations and the second form is a contact form) Thanks again.

    Plugin Author codepeople

    (@codepeople)

    Hello @mrmet86

    Yes, that’s possible. Insert the form shortcode by passing a class name through its shortcode.

    E.g.

    [CP_CALCULATED_FIELDS id="1" class="form-a"]

    Second, pass the form selector as the second parameter in the getField operation:

    E.g.

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

    Best regards.

    Thread Starter mrmet86

    (@mrmet86)

    Thank you, tremendously!

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