sweetify-django
sweetify-django copied to clipboard
Handling event if ok button is clicked
How to do that ?
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.
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
?