dstreet / dependsOn

a jQuery plugin for handling form field dependencies
http://dstreet.github.com/dependsOn
MIT License
106 stars 32 forks source link

Intersecting checkboxes #29

Closed decadence closed 8 years ago

decadence commented 8 years ago

Hello. Thanks for great plugin, I have one problem. I was looking for solution to problem when change event doesn't work for programmatic change and I think I found it here https://github.com/dstreet/dependsOn/issues/18.

Version: 1.3.0.

But when I update lib this code stops working:

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>

    <script src="./jquery-3.1.1.min.js"></script>
    <script src="./dependsOn.min.js"></script>

    <script>
        $(function () {
            $("#first").dependsOn({
                "#second": {
                    checked: true,
                }
            }, {
                hide: false,
                disable: false,
                checkOnEnable: false,
            });

            $("#second").dependsOn({
                "#first": {
                    checked: true,
                }
            }, {
                hide: false,
                disable: false,
                checkOnEnable: false,
            });
        });
    </script>
</head>
<body>

<input type="checkbox" id="first"> 1
<br>
<br>
<br>
<input type="checkbox" id="second"> 2

</body>
</html>

I want to each checkbox unchecks if another is checked but it doesn't work properly sometimes. It works only on second time check.

Can you also update dependsOn.min.js when you're doing release, because I can't right away understand that it's out of date and I have to run gulp manually to build final file. Not everybody uses gulp or bower and they just need final file.

Thanks.

decadence commented 8 years ago

@dstreet Bump

dstreet commented 8 years ago

Thanks for reporting this. I'll try to take a look at this later today

dstreet commented 8 years ago

This should be fixed now, and is included in the v1.3.1.

decadence commented 8 years ago

Thanks for fast response ;)

decadence commented 8 years ago

I just tested it again and it works as expected. And other dependencies works well when checkbox's state changed by plugin. Thanks for help.

dstreet commented 8 years ago

👍

decadence commented 8 years ago

@dstreet I was looking another issues of this repo and found my old question here https://github.com/dstreet/dependsOn/issues/28. Can you provide some info?