Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Pym opened this issue Feb 26, 2014 · 4 comments
Closed

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

Pym opened this issue Feb 26, 2014 · 4 comments

Comments

@Pym
Copy link

Pym commented Feb 26, 2014

$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?

@MrTrick
Copy link

MrTrick commented Aug 29, 2014

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)

@brianreavis
Copy link
Member

This is fixed by 1e391b1

@MrTrick
Copy link

MrTrick commented Jan 30, 2015

Hooray, thank you.

@Ridwan247
Copy link

$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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants