Link to home
Start Free TrialLog in
Avatar of Crystal Rouse
Crystal RouseFlag for United States of America

asked on

Using isConfirm with a SweetAlert

I have a SweetAlert with a Cancel option.  My javascript has the isConfirm function and works correctly if isConfirm is true.  It just bypasses the code for the else statement. Any thoughts?

 swal({
                title: "Add New Action/Task",
                text: "This will add a new Action/Task to the stored Action List for future use.  If you do not wish to save this Action for later, click Cancel and choose Other.",
                type: "warning",
                showCancelButton: true,
                cancelButtonText: "Cancel",
                buttons: true,
                dangerMode: true,
                closeOnConfirm: true,
                closeOnCancel: true,
                confirmButtonText: "Yes"
            },
                function (isConfirm) {

                    if (isConfirm) {
                        CM.disabled = false;
                        CM.style.backgroundColor = "white";
                        actionOther.style.backgroundColor = "white";
                        actionOther.placeholder = "Enter New Action/Task";
                    }

                    else {
                        CM.disabled = false;
                        actionDropdown.value = "Other";
                        actionDropdown.text = "Other (Enter Other Action/Task)";
                        actionOther.placeholder = "Enter Other Action/Task";
                    }

                }.bind(this));

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Crystal Rouse

ASKER

We have probably one of the very first versions. We've never upgraded it.
I fixed it myself.  Simply replaced: }.bind(this));
with });
I fixed it myself.  Simply replaced: }.bind(this));
 with });
I fixed it myself.  Simply replaced: }.bind(this));
 with });
sweetAlert is used in older versions.