sweet-alert icon indicating copy to clipboard operation
sweet-alert copied to clipboard

Confirm before deletion

Open afrasiyabhaider opened this issue 5 years ago • 17 comments

I am using Laravel 6.5 with sweet alert's 2.0.3 version

I want to know that, how to display the confirm button before the deletion of data? If user press yes delete it it should be deleted otherwise it shouldn't be deleted

afrasiyabhaider avatar Nov 08 '19 19:11 afrasiyabhaider

Duplicate #17

realrashid avatar Nov 08 '19 20:11 realrashid

Hey @realrashid how are you? Did you added this feature in your new release? If so then please let me know

afrasiyabhaider avatar Dec 20 '19 18:12 afrasiyabhaider

Hello @realrashid , have you added it?

delvin20 avatar Mar 07 '20 06:03 delvin20

Hey, Now i am free and i will give time to add this feature to this package. 🎉

realrashid avatar Mar 09 '20 11:03 realrashid

Thanks a lot @realrashid :)

delvin20 avatar Mar 10 '20 04:03 delvin20

@realrashid, well done. Please we still await this update. Regards

samlorlah avatar Apr 02 '20 17:04 samlorlah

@realrashid bro will this feature available in next update?

afrasiyabhaider avatar Apr 05 '20 11:04 afrasiyabhaider

I still need to write some dynamic code to make this function flexible. If you can share how you are doing in the moment this really help me to write simple helper functions.

Please Share to at [email protected].

Thanks for your support. :heart:

realrashid avatar Apr 06 '20 17:04 realrashid

@realrashid Any news about this feature?

samuelhgf avatar Apr 22 '20 14:04 samuelhgf

I saw you closed it but Still wondering how do you handle delete confirmation ? I couldn't find any proper answer. we need to delete and confirm from controller ?

erenergul avatar Oct 16 '20 20:10 erenergul

any new sugguestions to how to handled confirmation from the blade before sending the request to the controller

nizartcht avatar Feb 12 '21 13:02 nizartcht

Hey Guys..

Please checkout https://dev.to/realrashid/how-to-use-sweetalert2-with-livewire-56i6 this.

Thanks

realrashid avatar Feb 17 '21 18:02 realrashid

In Live Wire there is a Custom coded JS confirmation box which can still be used in Blade component with Custom coding.... But can you please include it into your package so we dont have to use custom coding?

@realrashid

afrasiyabhaider avatar Mar 02 '21 06:03 afrasiyabhaider

guys, if you want to show confirm button before deleting a data in your blade file you can add this script:

Swal.fire({
    title: 'Yakin ingin menghapus data?',
    text: "You won't be able to revert this !",
    icon: 'warning',
    showCancelButton: true,
    confirmButtonColor: '#3085d6',
    cancelButtonColor: '#d33',
    confirmButtonText: 'Yes, delete it!'
}).then((result) => {
    if (result.isConfirmed) {
        $(`[data-penguji=${id_penguji}]`).parents('.raised.card').remove()
    }
})

syofyanzuhad avatar Sep 04 '21 15:09 syofyanzuhad

any update?

hiprm avatar Mar 20 '22 05:03 hiprm

It's not added yet..

On Sun, Mar 20, 2022, 10:10 AM hiprm @.***> wrote:

any update?

— Reply to this email directly, view it on GitHub https://github.com/realrashid/sweet-alert/issues/57#issuecomment-1073169943, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADXCPBJHM6VD5XFBIHXYQQTVA2XMJANCNFSM4JK5UZYQ . You are receiving this because you were mentioned.Message ID: @.***>

realrashid avatar Mar 21 '22 11:03 realrashid

guys, if you want to show confirm button before deleting a data in your blade file you can add this script:

Swal.fire({
    title: 'Yakin ingin menghapus data?',
    text: "You won't be able to revert this !",
    icon: 'warning',
    showCancelButton: true,
    confirmButtonColor: '#3085d6',
    cancelButtonColor: '#d33',
    confirmButtonText: 'Yes, delete it!'
}).then((result) => {
    if (result.isConfirmed) {
        $(`[data-penguji=${id_penguji}]`).parents('.raised.card').remove()
    }
})

That is not a good solution, because the Swal is not defined on the page if there wasn't other alert before. This is only works with the SWEET_ALERT_ALWAYS_LOAD_JS=true .env variable.

Diverti avatar Mar 21 '22 17:03 Diverti