Send e-mail confirmation on edit

Send e-mail confirmation on edit

loerezloerez Posts: 7Questions: 3Answers: 0

I'm using the DT Editor with bubble editing for my backend, like in this example:
https://editor.datatables.net/examples/bubble-editing/options.html

Is it possible to add a checkbox inside the bubble that says "Send E-Mail?" and call an AJAX script to send a mail if the checkbox is checked and the update button is clicked?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    Sure - use a postEdit event (server-side processing events) to send the e-mail. You could just add an extra field to the Editor form that has that toggle. Give it a default value (fields.def) and just don't define it in the PHP (or .NET) fields list (you don't want to write it to the database!).

    Allan

  • loerezloerez Posts: 7Questions: 3Answers: 0

    Thanks for your tip about the postEdit event.
    Unfortunately i forgot to mention that i need this function for only one single field: the payment status of a customer. If our admins mark a customer's status as "paid", they should have the option to send a confirmation. Adding an extra field won't do the job.

    To clarify my plan, this is what it currently looks like:
    http://matthiaskampf.de/tmp/scr-payment-before.jpg

    And this is what i'm trying to achieve:
    http://matthiaskampf.de/tmp/scr-payment-after.jpg

    Is this possible with DT Editor or do i need to think of a workaround?

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    Answer ✓

    Since you are using bubble editing it is even more possible. Just tell bubble() to use two fields. You can do that with columns.editField (example) or using bubble() itself.

    Allan

  • loerezloerez Posts: 7Questions: 3Answers: 0

    Awesome, thank you Allan! Thumbs up for your great support!

  • BodockBodock Posts: 1Questions: 0Answers: 0
    edited January 2017

    I'm looking for the same thing, I need to send an email when column "STATUS" changes row value to "COMPLETED", the email is to be send to the email value in the same row on column EMAIL, is it possible to share an example code showing how to achieve this?

    I figured out how to use the multiple fields, I just don't know how to send the email when I click UPDATE.

    Thanks.

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    The best way is to use a server-side event. Then you can simply use whatever mail method you have available on the server-side (e.g. in PHP you could use mail()).

    Allan

This discussion has been closed.