3 ms·
True but you can also use it with ok/cancel options, which I think fits the use case you mentioned when you said: > if the user is doing something that can des
by jfaat 12y ago
True but you can also use it with ok/cancel options, which I think fits the use case you mentioned when you said:
> if the user is doing something that can destroy data without the possibility of undoing their actions then you'll want a dialogue that asks them if they're sure
- jcampbell1 12y agoAs far as I can tell, there are no callbacks. With javascript's confirm, you can do: if(confirm(....)) { doStuff() } else { cleanup() } This should at least have a callbacks for the different buttons. In terms of design, I don't like absolute vertical centering. It should be higher on the page. I use 1:2, or 1:1.6 for the top/bottom margin as my "default" modal centering.
- jfaat 12y agoOh wow, I just assumed those were tied to callbacks instead of just being a showCancelButton arg. The more I look into it the more underwhelmed I become.
- acdha 12y agoOne of the examples shows that they have a single callback function: http://tristanedwards.me/sweetalert http://tristanedwards.me/sweetalert Unfortunately, there's only one function so this isn't useful if you want to run code when the user cancels the dialog: https://github.com/t4t5/sweetalert/blob/750a0fd72c3beaa6d4d71336290def4d71d3ecd2/lib/sweet-alert.js#L298 https://github.com/t4t5/sweetalert/blob/750a0fd72c3beaa6d4d7...
- drzaiusapelord 12y ago>ok/cancel options, So, if I click OK am I acknowledging the alert to dismiss it or is performing an action? If I hit cancel am I canceling the alert or canceling the action? Its still terrible UI. Limiting the options to things like "ok" and "cancel" can be very confusing to the end user. Don't you agree? {OK} {Cancel}
- jfaat 12y agoI wasn't clear enough, but the confirmation button text can be customized. So as a quick example you could do something like this: Are you sure you want to delete? {Yes, delete thing X} {No, keep it} Would you still find that insufficient communication with the user? No sarcasm, genuinely interested to get your opinion.
- emergentcypher 12y agoCancelling the alert? That doesn't even make sense.