Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling event if ok button is clicked #9

Open
ua4ever opened this issue Aug 19, 2019 · 2 comments
Open

Handling event if ok button is clicked #9

ua4ever opened this issue Aug 19, 2019 · 2 comments

Comments

@ua4ever
Copy link

ua4ever commented Aug 19, 2019

How to do that ?

@Atrox
Copy link
Owner

Atrox commented Aug 23, 2019

Hey @ua4ever,

sweetify is more or less for informational one-time messages only. There is currently no (prebuilt) way to handle clicks.

I'm happy to accept a PR, if you find a good solution for this in sweetify.

@PauMAVA
Copy link
Contributor

PauMAVA commented Apr 23, 2021

I think that with sweetalerts2 you can do the following:

Swal.fire(
    ...
).then(result) {
    if (result.isConfirmed) {

    } else if (result.isDenied) {

    }
    ...
}

The parameters of result are the following as described in the official docs:

isConfirmed | The "Confirm" button was clicked, the value will contain the result
isDenied | The "Deny" button was clicked, the value will be false. Alternatively, if there's an input in a popup, you can use returnInputValueOnDeny: true to return the input's value.
isDismissed | The "Cancel" button was clicked, the dismiss will be Swal.DismissReason.cancel
value | The value from the popup, possible values:                        
 * true for simple confirmed dialogs             
 * false for denied popups             
 * any value for popups with inputs
dismiss | The dismissal reason, see the Handling Dismissals section for details

Maybe we could try to port this to sweetify?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants