Custom confirm delete message #271
-
Hello, quick question: Is it possible to customize the confirmation message when deleting a crud resource depending on the resource? I know i can change the translation for all resources, but can i display a different message depending on the resource being deleted? Can i set this, for example, in the crud controller for the resource? I can't seem to find the answer in the docs or by googling. Any help would be greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
I'm currently trying to do this too..... still no answers in here eh? If I figure it out I'll reply |
Beta Was this translation helpful? Give feedback.
-
Hi guys @adamhaley & @fractalbit ... i was wondering that too and got it to work. Just take advantage of the noty message system backpack is using.
Instead of using error you can also use success in case it is successful etc.. Here an example for multiple messages:
Hint: When you intercept the destroy/delete procedure make sure you hand over the ID to the delete hook in case you want to delete the item after doing your checks. Or do not hand it over if you do not want to delete it ... and of course show the custom error message. Overall your CRUD function could look like this:
That's it ... worked for me. |
Beta Was this translation helpful? Give feedback.
-
I will close due to not activity, thanks @webboty for that answer. |
Beta Was this translation helpful? Give feedback.
Hi guys @adamhaley & @fractalbit
... i was wondering that too and got it to work.
Just take advantage of the noty message system backpack is using.
When you intercept the delete you can send back with a return of an array of a specific structure.
Instead of using error you can also use success in case it is successful etc..
If you have multiple bubbles you want to show ... just add more by increasing the counter at the end per type.
Here an example for multiple messages: