my select2 box working oddly multiple selection turned on. when submit form sends duplicate post data in mirror-like fashion.
for example, select
'united states','united kingdom','ireland'
it posts (reported firebug , shown in html result)
'united states','united kingdom','ireland','united kingdom','united states'
my html countries(slimmed down)...
<select multiple name="country" id="country" class="select2" data-placeholder="select country/countries" style="width:220px;" required> <option value=""></option> <option value="united states">united states</option> <option value="united kingdom">united kingdom</option> <option value="afghanistan">afghanistan</option> <option value="albania">albania</option><option value="zimbabwe">zimbabwe</option> </select>
and js calls
$('.select2').select2();
i have no idea why might happening. i'm using other js libraries bootstrap,jqueryvalidate,and zebra datepicker, don't think interfere.
you may have called $('.select2').select2(); function twice. faced same issue , reason had called function twice same dropdown.
Comments
Post a Comment