bootstrap-select icon indicating copy to clipboard operation
bootstrap-select copied to clipboard

Error when selecting first item

Open LKay opened this issue 10 years ago • 7 comments

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].

LKay avatar Mar 08 '16 03:03 LKay

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:

  1. Provide environment details. Provide your operating system, browser(s), jQuery version, Bootstrap version, and bootstrap-select version.
  2. Create an isolated and reproducible test case. Create a reduced test case.
  3. Include a live example. Make use of jsFiddle or jsBin to share your isolated test cases.

caseyjhol avatar Mar 08 '16 03:03 caseyjhol

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.

ni8mr avatar Mar 23 '16 04:03 ni8mr

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.

caseyjhol avatar Apr 01 '16 17:04 caseyjhol

  1. 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.

  1. I didn't check it in case of single option.

  2. It is not multiple select.

I have overcome the behavior by using event.preventdefault() method and blocking default behavior for now.

ni8mr avatar Apr 05 '16 12:04 ni8mr

How are you populating it with JSON? Can I see the code you're using for that?

caseyjhol avatar Apr 06 '16 16:04 caseyjhol

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

ni8mr avatar Apr 08 '16 19:04 ni8mr

Please try the latest release and let me know if the issue persists.

caseyjhol avatar Sep 03 '18 17:09 caseyjhol