thooams / ui-bibz-js

Ui Bibz Js for webpack
0 stars 2 forks source link

ui_box_switch_field always initialized to OFF visually (even if checkbox is checked) #5

Open mildred opened 3 years ago

mildred commented 3 years ago

The problem happens with ui_box_switch_field and not ui_switch_field

A form initialized with the following markup contains a ui_box_switch_field. The markup sent by the server is:

<div class="switch-field-container">
  <input type="hidden" name="search[design][2e4a02f4-2a88-4d7e-b9de-01574eb57c66][library_view][modules][filters][active]" id="search_design_2e4a02f4-2a88-4d7e-b9de-01574eb57c66_library_view_modules_filters_active" value="0" />
  <input type="checkbox" name="search[design][2e4a02f4-2a88-4d7e-b9de-01574eb57c66][library_view][modules][filters][active]" id="search_design_2e4a02f4-2a88-4d7e-b9de-01574eb57c66_library_view_modules_filters_active" value="1" checked="checked" data-on-text="Oui" data-off-text="Non" data-label-text="Activé" class="switch-field" />
</div>

However, the switch appears visually off:

image

The markup after JS initialisation is:

<div class="switch-field-container">
  <input type="hidden" name="search[design][2e4a02f4-2a88-4d7e-b9de-01574eb57c66][library_view][modules][filters][active]" id="search_design_2e4a02f4-2a88-4d7e-b9de-01574eb57c66_library_view_modules_filters_active" value="0">
  <div class="bootstrap-switch-undefined bootstrap-switch-undefined bootstrap-switch-undefined bootstrap-switch-undefined bootstrap-switch bootstrap-switch-wrapper bootstrap-switch-animate" style="width: 112.2px;">
    <div class="bootstrap-switch-container" style="width: 157.883px; margin-left: -47.6833px;">
      <span class="bootstrap-switch-handle-on bootstrap-switch-primary" style="width: 51px;">Oui</span>
      <span class="bootstrap-switch-label" style="width: 62.5167px;">Activé</span>
      <span class="bootstrap-switch-handle-off bootstrap-switch-default" style="width: 51px;">Non</span>
      <input type="checkbox" name="search[design][2e4a02f4-2a88-4d7e-b9de-01574eb57c66][library_view][modules][filters][active]" id="search_design_2e4a02f4-2a88-4d7e-b9de-01574eb57c66_library_view_modules_filters_active" value="1" checked="checked" data-on-text="Oui" data-off-text="Non" data-label-text="Activé" class="switch-field">
    </div>
  </div>
</div>

There are suspicious bootstrap-switch-undefined classes

thooams commented 3 years ago

I'm going to investigate