Email notification when pressing button on lightbox

I would like to implement email notification when user clicks on button in lightbox, im using scheduler stand alone. I’ve seen examples on how to do it in PHP and using the connector.php, but none with c#.

Normally scheduler interacts with server side only during data saving. It is quite simple to add a custom code to the saving logic - it can be done through server side events ( while syntax differs a bit - the concept for .net is the same as for php )

If you want to trigger action from custom buton without saving - you need to define js handler for custom button, and from it make an ajax call to the necessary server side uri

I was able to create a custom button, and define the js handler for it. Would you be able to show a sample of ajax call to the server side uri?

I want to be able to just click the button and a default email is sent out to a default email.

thank you.

This is my button function on lightbox

scheduler.attachEvent("onLightboxButton", function(button_id, node, e){
                   
                document.location = "<%= Url.Action("../Mail/") %>";
                
                //scheduler.endLightbox(true); 
                alert("Email sent");
                return true;
                        
                });

And in the controller “Mail”

public class MailController : Controller
    {
        //
        // GET: /Mail/

        private IUserMailer _mailer = new UserMailer();
        public IUserMailer Mailer
        {
            get { return _mailer; }
            set { _mailer = value; }
        }
        
        public ActionResult Index()
        {
            Mailer.Welcome().Send();
           
            return Redirect("/mvccalendar/calendar");
            
        }

Is there a better way to be able send the email without redirecting the view or calling the controller this way??

Instead of reloading all page you can make an ajax call

scheduler.attachEvent("onLightboxButton", function(button_id, node, e){ var url = "<%= Url.Action("../Mail/") %>"; dhtmlxAjax(url, function(){ alert("Email sent"); }); return true; });

Thank you!

I modified to this for it to work. Added “.get”

var url="<%= Url.Action("../Mail/") %>";
                dhtmlxAjax.get(url,function(){
                alert("Email sent");
                });
                return true;
                });

I was able to send the email now. Next thing I would like to is “get” values for my Custom Fields in LightBox, to be able to pass them to the email.

  1. How can I get the value for my fields on the lightbox.
  2. send them to the controller “Mail”

Thank you.

I’d be curious to know how to get to the event information as well. Any detailed tips would be greatly appreciated as I’ve been scouring the forums for the past several hours.

Thanks!

How can I get the value for my fields on the lightbox.

You can use getEvent to get event object with all properties

var obj = scheduler.getEvent(id) var value = obj.property_name

Also, there is a separate api to access values of active lightbox

docs.dhtmlx.com/doku.php?id=dhtm … x_sections
docs.dhtmlx.com/doku.php?id=dhtm … ormsection