How can I access, disable and populate the From input on the Send Mail modal form

0 Answers 102 Views
Report Viewer - HTML5
Sean
Top achievements
Rank 1
Iron
Iron
Sean asked on 06 Nov 2023, 04:13 PM

I would like to populate and disable the From input from the client. I am running into a few issues:

 

1. It appears the viewer page is blocking the bundled javascript include. As a work around I am including the script file in the header which works fine and acceptable for me.

    <script src="@Url.Content("~/scripts/reportsportal.js")"></script>

2. It appears that something is blocking the ability to bind to the event SEND_EMAIL_BEGIN

ex in my script file reportsportal.js I am attempting to bind to the SEND_EMAIL_BEGIN so that I can populate and disable the FROM input using jquery

 

However it appears that my script file is getting blocked and the following message is displayed in the browser console:

Autofocus processing was blocked because a document already has a focused element. 

 

I don't think the script runs at all.

 

$(document).ready(function () {
    if (reportViewer) {

        reportViewer.bind(telerikReportViewer.Events.SEND_EMAIL_BEGIN, function (e) {
            debugger
            console.log(this.id);
        });
    }


});

 

 

 

 

3. As a work around to not being able to bind to SEND_EMAIL_BEGIN , I wired one of the declarative events on the viewer widget:

        .ClientEvents(ev=>ev.PageReady("printPageReady"))

 

In printPageReady I was able to capture the From field with a selector

function printPageReady() {
    var t = $('input[name="from"]')
    t.val('test@yahoo.com')
}

Setting val on input[name="from"] DOES NOT generate any exceptions and checking the variable t in the console shows that a value has been assigned however when the Send Email dialog pops up the From input is still empty.

 

 

Is there another approach that I can use to access, disable and populate the From input from the client.

 

 

No answers yet. Maybe you can help?

Tags
Report Viewer - HTML5
Asked by
Sean
Top achievements
Rank 1
Iron
Iron
Share this question
or