I have authored several custom Console Dashboards that give different functionality based on user input, using JavaScript. Simple things like checkboxes, textbox search fields, etc.
I’m trying to port some of these to BES Web Reports to give some search functions to non-console operators. I’m having some difficulty with the DOM though. If I include any script for the document.onLoad() event it does not fire and no further script code will execute. If I remove the document.onLoad(), I cannot access any properties through the document object - no document.getElementById() calls work, for example.
Can anyone give tips on retrieving document properties via script in BES Web Reports?
What I suspect is that internally our custom web report may be in some kind of <eval> or ‘include’ block of the main page, and is somehow not included as part of the top-level document object. Maybe I’m totally off my rocker on that one though.
What I haven’t been able to find are any references as to what should work in a BES web report.
I’ve made some progress to share. Here are a couple of things I’ve found. Given the various function definitions below, the remaining part of the function executes or does not execute as the comments describe
> // document.onload does not work at all
> //document.onload=function(){
> // Defining window.onload in this way works in a Console Dashboard but not in a BES Web Report
> //function window.onload() {
> // Defining the function in this way as part of either this.onload or as window.onload does work in BES Web Reports. Still need to check it in a Console Dashboard.
> //this.onload=function(){
> //window.onload=function(){
> alert('Hello from onload');
> alert(Object.keys(this).join('\n'));
> };
I need to get the functionality of onload() working because as part of my “real” onload I will be populating a Relevance query based on the content of a textarea (which has a default value), but the given textarea element may not exist until the document has finished loading. So I believe the best way to handle that is through the onload() event.
And now I can’t find a reference to actually using document.onLoad() in my Dashboards, I was actually using window.onload().
it would die on BES Web Reports rendered in Chrome but would work correctly in the Console. I suspect that the proper thing is to die there (the checkbox does have a ‘name’ but not an ‘id’), but IE seems to be forgiving in that case. It works properly in both environments when I change the checkbox ‘name’ to an ‘id’.