Close and save Lightbox from embedded iframe


I have an area in my lightbox that has two buttons. When a user clicks the button I want the scheduled event to save, then close the lightbox and send an email.

Here is my custom code:

            return "<iframe border='0' width='100%' height='150' id='dispatch_iframe'></iframe>";
            $('dispatch_iframe').src = "job_details.php?JobID="+ev.PWPJobs_ID+"&ScheduledJobID=""&PWPScheduledJobStatuses_ID="+ev.PWPScheduledJobStatuses_ID;
        // called when SAVING the form
            var innerDoc = $('dispatch_iframe').contentDocument || $('dispatch_iframe').contentWindow.document;

            if ( innerDoc.getElementById('PWPScheduledJobStatuses_ID') ) {
                return innerDoc.getElementById('PWPScheduledJobStatuses_ID').value;
            else {
                return '4'; //To Be Scheduled

The iframe itself has three buttons and some text. Here is an example of one of the buttons

                <form method='post' action='/schedule/dispatch_job.pgm.php?ScheduledJobID={!$ScheduledJobID}'>
                    <input class="button" type='submit' value='Dispatch' onclick='return confirm("Are you sure you want to dispatch this job?")'>

It does some stuff to change the values for the object and then sends it back to the iframe to change the display. Instead of doing that, I want the lightbox to save the whole task so an email can be sent with the most updated contents.

Any pointers would be greatly appreciated!


You can change the buttons code as

It will trigger data saving functionality of scheduler in the parent frame.
As for email sending - it need to be processed on the server side as part of scheduler’s data saving.