As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
I've never been short on complaints about the HTML composer, but this just takes the cake.
I have a javascript file to include in all my HTML reports. I want to include it at the end of my HTML, so that it gets executed after the content above has been parsed. I do not want the code to live within the window_onload function.
I included the script reference directly above the closing body tag, like so
and included at a seemingly-random spot in the middle of the HTML, which means it is not executed after page content is parsed and the functionality breaks.
Is there anything at all I can do to prevent this? This behaviour means I can't trust anyone to open my HTML report in the GUI unless they know AND remember to undo this mess before saving.
Why any developer would ever think this was a good idea is completely beyond me.This message has been edited. Last edited by: <Kathryn Henning>,
WebFocus 7.7 Windows Server 2008 R2 HTML Reporting
The parsing of HTML is not an exact science, different browsers will behave differently. Basically you should never rely on a piece of javascript being run at particular point in time because of its position in the code. Thats what the unload type methods are for.
So I do not see a particular problem with the Javascript to be moved to a different location.
Alan. WF 7.705/8.007
Posts: 1451 | Location: Portugal | Registered: February 07, 2007
If you import the JS file correctly, the HTML Composer will give it and and id = ITEM1 and set it up the way you have observed. You can open a case and maybe we can work around the issue depending on what you are trying to do.. You can ask that Barry gets assigned the case.
Thanks Barry
WebFOCUS 8103, Windows, App Studio
Posts: 80 | Location: NYC | Registered: November 13, 2008
There are a number of reasons for including JavaScript references at the very end of an HTML document, including Yahoo's performance advice.
I'm attempting to introduce a mechanism where non-web developers can have a single line of code to include at a specific place and not have to worry about it. It would be possible for my code to be added to the window_onload function but it's more likely to go wrong when edited by someone who doesn't know what they're doing. My main aim is to override the form.onsubmit event after it has originally been defined. I can't completely overwrite the event handler, as the original handler must be executed as part of mine. This means my code has to be executed after the page has been parsed including the <form> element which includes an onsubmit handler.
I can understand why the HTML composer would handle scripts imported through its GUI in a particular way, but for it to be shredding HTML that I have manually added is just crazy. It violates the Principal of Least Astonishment.
WebFocus 7.7 Windows Server 2008 R2 HTML Reporting
In the end I had to refactor my code to deal with this behaviour. Fortunately if I add an external script resource its script tag is included at the end of the head section, after the function that I want to override has been defined.
I still think that Developer Studio is over-complicating this, and it's getting in my way more than helping. It converts my perfectly reasonable script tag into this monstrosity:
WebFOCUS is the only place I've seen capitalised HTML tags in the last 5 years, but the bigger concerns are why a script resource needs a z-index and why attribute quoting is inconsistent. Very strange.
My purpose in all of this was to alter the URL used to execute an HTML report's referenced .fex so that I could route the request through my site's proxy, acquiring an authentication token along the way if the user is authenticated (required to then pass through a Tomcat filter). However I didn't want the URL to be permanently altered, as the same location is used to get dynamic list values and my proxy doesn't handle those. I've pasted the code below in case anyone else has a similar requirement.
window_onload = function(originalOnload) {
return function() {
originalOnload();
var allInputs = document.getElementsByTagName('input'), i, eachInput;
for(i = 0; i < allInputs.length; i++) {
eachInput = allInputs[i];
if(eachInput.hasOwnProperty('type') && eachInput.type.toLowerCase() === 'submit') {
eachInput.onclick = function() {
var originalGetWFScriptName = getWFScriptName; // returns original execute URL
getWFScriptName = function(){return 'http://<mysite/proxy>/';};
// reinstate original function after current execution stack completes
setTimeout(function(originalFunc) {
return function() {
getWFScriptName = originalFunc;
}
}(originalGetWFScriptName), 0);
};
}
}
};
}(window_onload);
WebFocus 7.7 Windows Server 2008 R2 HTML Reporting
I then have to change "rtFileName" back to "src" (because we're at v7703 HF 5).
That was actually a bug (in Dev Studio 7703) introduced with HF5 or something and is now fixed with HF7. This particular bug has for me resulted in many extra coffee breaks to cool off. It has gotten to the point that I postpone changes to launch-pages as long as possible, as I really don't want to. By now, I absolutely hate HTML Composter. IMHO, it has taken IBI far too long to release the fix.
Anyway, it's been fixed.
As for the OP's problem; it doesn't ring a bell, but in general it is bad form to expect that the page finished loading at the end of the HTML tags. At the very least, at that point the browser hasn't parsed the closing body and html tags yet, meaning the DOM isn't yet complete when your script might already be referencing it. Another issue is that IBI's code runs when the document finishes loading (they use window.onload), which happens after those closing tags have been parsed, which means it could run just after your script runs. Timings like these will differ between browsers and network latencies, but it will probably be unreliable.
I think what you're supposed to do is to wrap your code in a function and call that from IBI's onInitialUpdate() function, which by default isn't added to the local code but will be called if it exists.
Of course, if your script is entirely independent of the DOM or IBI's code, then what you do is perfectly legitimate. But then it wouldn't matter where in the document it gets called, so it probably does rely on some of that stuff.
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010 : Member of User Group Benelux :