Skip to content
This repository was archived by the owner on Apr 18, 2026. It is now read-only.
This repository was archived by the owner on Apr 18, 2026. It is now read-only.

.disable() does not add a disabled attribute to the input element #307

Closed

Description

@Pym
$select_region = $('#form_region').selectize();
select_region = $select_region[0].selectize;
select_region.disable();

gives me:

<select id="form_region" name="form[region]" required="required" class="selectized" placeholder="Region" tabindex="-1" disabled="" style="display: none;">
    <option value="" selected="selected"></option>
</select>
<div class="selectize-control single">
    <div class="selectize-input items required not-full has-options invalid disabled locked">
        <input type="text" autocomplete="off" tabindex="" placeholder="Choose a region" required="" style="width: 173px; opacity: 1; position: relative; left: 0px;">
    </div>
    <div class="selectize-dropdown single" style="display: none; width: 301px; top: 36px; left: 0px; visibility: visible;">
        <div class="selectize-dropdown-content">
            <div data-value="1" data-selectable="" class="option">first</div>
        </div>
    </div>
</div>

The problem here is that because the input is not disabled, the browser will prevent the user to send the form. I don't think that it's the expected behavior. Can you please fix this?

Activity

  1. MrTrick commented on Aug 29, 2014

    @MrTrick

    I agree that this is a problem.

    1. For an ordinary <input type="text" required> the browser will not allow the form to submit when empty.
    2. If disabled; <input type="text" required disabled> the browser will allow it.
    3. Selectize's behaviour does not match.

    (The $control_input should be disabled or un-required when selectize.disable() is called)

  2. brianreavis commented on Jan 30, 2015

    @brianreavis
    Member

    This is fixed by 1e391b1

  3. MrTrick commented on Jan 30, 2015

    @MrTrick

    Hooray, thank you.

  4. Ridwan247 commented on Nov 10, 2021

    @Ridwan247

    $select_region = $('#form_region').selectize();
    select_region = $select_region[0].selectize;
    select_region.disable();

    Thank you pym, it's work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions