Error when selecting first item
I'm using bootstrap-select for my project and I'm experiencing some weird behavior. When I have many options in the select box then I can select them just fine, but for some reason, when I select the first item with index of 0 I get the error in the console: Uncaught RangeError: Maximum call stack size exceeded. at bootstrap-select.js:168.
That only happens when selecting the first item in the select box, others work without throwing an error.
Looks like in that particular case the native onChange event is being trigger recursively somehow.
The version I'm using is [email protected].
See guidelines for contributing.
Bug reports
A bug is a demonstrable problem that is caused by the code in the repository. Good bug reports are extremely helpful - thank you!
Guidelines for bug reports:
- Provide environment details. Provide your operating system, browser(s), jQuery version, Bootstrap version, and bootstrap-select version.
- Create an isolated and reproducible test case. Create a reduced test case.
- Include a live example. Make use of jsFiddle or jsBin to share your isolated test cases.
I am having same problem. My OS is - Ubuntu 15.04 LTS and my browser is - Mozilla Firefox 44.0.
I can't select the first option until i select 2nd/3rd one.
Can you show me an example? Does it only happen with lots of options? Is it a multiple select? Any additional information that would help me recreate this would be great. The faster I can recreate it, the faster I can start working on a fix.
- Here are my select fields created based on bootstrap-
<div class="form-group row">
<label class="col-sm-2 form-control-label">Country</label>
<div class="col-sm-10">
<select class="form-control selectpicker show-tick" name="country" id="country" title="Select country..." data-live-search-placeholder="Search desired country here" data-live-search="true">
</select>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 form-control-label">Division</label>
<div class="col-sm-10">
<select class="form-control selectpicker show-tick" name="division" id="division" title="Select division..." data-live-search-placeholder="Search desired division here" data-live-search="true">
</select>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 form-control-label">District</label>
<div class="col-sm-10">
<select class="form-control selectpicker show-tick" name="district" id="district" title="Select district..." data-live-search-placeholder="Search desired district here" data-live-search="true">
</select>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 form-control-label">Sub-district</label>
<div class="col-sm-10">
<select class="form-control selectpicker show-tick" name="sub-district" id="subdistrict" title="Select sub-district..." data-live-search-placeholder="Search desired sub-district here" data-live-search="true">
</select>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 form-control-label">Post Code</label>
<div class="col-sm-10">
<select class="form-control selectpicker show-tick" name="post-code" id="post-code" title="Select post-code..." data-live-search-placeholder="Search desired post-codes here" data-live-search="true">
</select>
</div>
</div>
I am populating them from a JSON file. In all the fields, same behavior is happened.
-
I didn't check it in case of single option.
-
It is not multiple select.
I have overcome the behavior by using event.preventdefault() method and blocking default behavior for now.
How are you populating it with JSON? Can I see the code you're using for that?
My code is here - https://github.com/ni8mr/gpsl-ui/blob/gh-pages/location_selection.js
The code is running live here - http://ni8mr.github.io/gpsl-ui/. The form will be seen after clicking Add new location button.
If needed, JSON can be seen here - https://github.com/ni8mr/gpsl-ui/blob/gh-pages/dummy.json
Please try the latest release and let me know if the issue persists.