gitbrent / bootstrap4-toggle

Bootstrap 4 Switch Button / Toggle
https://gitbrent.github.io/bootstrap4-toggle/
MIT License
213 stars 67 forks source link

checkbox value + .visible #20

Open jeff73230 opened 5 years ago

jeff73230 commented 5 years ago

Hi everyone,

In a bootstrap project (i'm dev newbie), i would like to replace a yes/no dropdown list by a checkbox toggle button. with the following code :

'... label for="dc" class="col-sm-12 control-label">DC</label ... label for="imc" class="col-sm-12 control-label">IMC</label ... div class="col-sm-12" name="test_1Div" ... input type="checkbox" name="d_c" id="test_1" style="" required ... div class="col-sm-12" name="test_2Div" ... input type="checkbox" name="i_m_c" id="test_2" style="" required ... '

and following javascript :

``

when test_1 button is checked, i've got "on" writed in database, and "NULL" when button is left "off". But when i try to modify a record, i'm unable to get the button checked when value is "on". Is there anybody to help me about that ?

Second point : is there any opportunity to get the test_2 button visibility property to NO when test_1 is unchecked, and YES when test_1 is checked ? ... and force test_2 value to "NULL" when test_1 is unchecked ?

Thanks for any help or suggestion.

Best regards

gitbrent commented 5 years ago

I'm unclear on what you're looking for.

The docs on Event Propagation may help you.