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

Control doesn't change state when disabled or readonly

Open Drammy opened this issue 10 years ago • 3 comments

If a checkbox is disabled and the value it is bound to is altered from true to false the checkbox is unchecked. Its still disabled or readonly but the value is updated.

The bootstrap-switch doesn't work this way. When the bootstrap-switch is disabled or readonly and the value its bound to is altered the state doesn't change therefore becoming out of sync with the underlying value.

The switch's state should stay in sync with the value the switch is bound to.

Drammy avatar Apr 03 '15 09:04 Drammy

:+1: Related to https://github.com/frapontillo/angular-bootstrap-switch/issues/68

frapontillo avatar Apr 03 '15 09:04 frapontillo

I also have this need, it will be awesome if toggleDisabled/toggleReadonly methods accept a second parameter, to tell if the state have to remain in sync also if disabled/readonly.

ilbarzo avatar Jul 21 '15 12:07 ilbarzo

Is this still a "work in progress"? It would be great if this can be done. One switch relates to another disabled switch's value.

I tried to do this using jQuery:

$('input[name="obstacleStreet"]').on('switchChange.bootstrapSwitch', function (e, state){
        $('input[name="obstacleBowl"]').bootstrapSwitch('toggleDisabled', false);
        $('input[name="obstacleBowl"]').bootstrapSwitch('state', state);
        $('input[name="obstacleBowl"]').bootstrapSwitch('toggleDisabled');
    });

But still not working. If this is a known issue, is there any plan to make it available soon? Thank you

ak-rocksdev avatar Oct 23 '20 06:10 ak-rocksdev