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.
Found reference on techsupport to case 13502060 that documents the knownproblem of the onchange event not working w/ dynamically populated controls. Anyone have a usable workaround to this problem?
I've tried using onkeypressed and onclick and that seems to work for some cases, but not others. Specifically when I am trying to use a multi-select listbox, I can't get the desired behavior...
any thoughts?
Production: 7.6.6 WF Server  <=>  7.6.6 WF Client  <=>  7.6.6 Dev Studio Testing: <none> Using MRE & BID.  Connected to MS SQL Server 2005 Output Types: HTML, Excel, PDF
Thanks for saving my sanity. I have had this problem since moving to 7.1.3 from 5.3.2 where all my onchange events worked OK.
I have a set of combo boxes that have dynamic content and use the onchange event to display the next set of combos. I had to change the first one to an onclick event but managed to get away with the onchange event for the subsequent ones because I am only building them when required - i.e. using javascript document.createElement, and also because they are not chained(?).
I have tried everything I can think of to get around this but have not suceeded, so if anyone out there does have a solution then I am sure there are plenty of folks that would love to hear.
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
So I was poking around a little bit, and made some headway into this issue. However, I need a little help from someone with better Javascript skills them myself to complete a full workaround.
As I see it, when a page loads with chained dropdowns, the "onchange" event is overridden to call the function "OnResetDownChainControls". Therefore, if you add an onchange, it will never do what you want, rather, the OnResetDownChainControls function is called. So, I created a function thusly:
function button2_onclick(ctrl) {
form2.COUNTRY.onchange=combobox1_onchange;
}
that is called by a button I added to my layout. This will reset the onchange event on my dropdown box called COUNTRY. Then I created the onchange function called "combobox1_onchange" like so:
function combobox1_onchange(ctrl) {
OnResetDownChainControls(ctrl);
alert("This is a chagne");
}
Now, when I click the button, the onchange is set to the combobox1_onchange. This function calls the standard function to allow the chained dropdowns to work, then displays a simple message to indicate that it is doing what I expect it to do. When I change the value of the dropdown, the chained boxes work as per normal, and I get the alert message.
The problem I am having, is overriding the onchange event (button2) without having to initiate it via a button. I tried a body onload, but that causes the whole thing to stop working.
If anyone out there has something to add, please do so!
FYI: This was done with 713 on WinXP.
Regards
"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
I just realized something from Tony's reply. If you add an onclick event to the dropdown to call the button2_onclick function, then I think this is a suitable work around for the onchange problem.
Add: onclick=button2_onclick(this) to the dropdown box.
"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
Oh if it were so simple (I think ). As far as my thinking goes, there must be a problem within the ibirls.js module that gets rid of, or overrides, the onchange event. I come to this conclusion because when I create dynamic tags (select, span, input etc.), any onchange event I add using ctrl.attachEvent seems to be honoured. I must admit that I attach the event after a call to populateDynamicCtrl to fix the selects with dynamic values, therefore I might be circumventing the problem in that manner.
I suppose that, taking your thought one step further, you could call an onload script (to run after the UpdateData() IB standard) to go through all the selects in the page and perform a ctrl.attachEvent as you require and see if that overcomes the current problem until IB get a fix out.
Of course, if the problem is as simple as an ibirls.js problem, IB could just publish an update to that file (yeah, dream on!!).
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
Took me awhile to get back to this, but this actually helped considerably. I believe this to be a viable workaround.
Here's what I did based on both of your inputs...
I already had an onchange event that I was basically just calling from the onclick, onchange, and onkeypressed events on 2 of my chained dropdowns. I removed the onkeypressed trigger completely as it was no longer necessary. I added a new parameter_onclick function that is called by the onclick events of both dropdowns. That is the one that 'maps' the onchange event back to my parameter_onchange function. Then in my parameter_onchange function I simply added call to the OnResetDownChainControls function.
Here's what I mean, hopefully it makes sense:
function parameter_onclick(ctrl) {
ctrl.onchange=parameter_onchange;
}
function parameter_onchange(ctrl) {
OnResetDownChainControls(ctrl);
And both comboboxes look like this for their event mapping:
So basically the first time (and everytime) a user clicks on one of the dropdowns it remaps the onchange event of that dropdown to the actual onchange event which calls my parameter_onchange function.
Thanks to both of you, this worked out well and makes the onchange functionality usable again. IBI has no known workaround according to that case, so I think it might be wise to communicate this to them...
Production: 7.6.6 WF Server  <=>  7.6.6 WF Client  <=>  7.6.6 Dev Studio Testing: <none> Using MRE & BID.  Connected to MS SQL Server 2005 Output Types: HTML, Excel, PDF