Focal Point
[CLOSED] JS Command populateDynamicCtrl

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/9897096595

December 21, 2010, 10:05 AM
rdmcnally
[CLOSED] JS Command populateDynamicCtrl
Hello,

In ibirls2 there was a js command called populateDynamicCtrl. This allowed for the refresh of an object on an HTML page.

In ibirls3, this command is no longer available.

Is there another command in ibirls3 that has taken the place of populateDynamicCtrl?

Thanks,

Bob

This message has been edited. Last edited by: Kerry,
December 21, 2010, 10:18 AM
Tony A
Bob,

Check out DoResetDownChainControls(ctrl); where ctrl is an object in the chain

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 
December 21, 2010, 10:26 AM
rdmcnally
Tony,

I'm a novice when it comes to these js commands.

Here's my original code:
//Begin function combobox1_onchange
function combobox1_onchange(ctrl) {
objCtrl = document.getElementById('combobox5');
populateDynamicCtrl(objCtrl);
}
//End function combobox1_onchange

Would you mind explaining how the DoResetDownChainControls(ctrl) command would work in this case?

Thanks!

Bob
December 21, 2010, 11:23 AM
Tony A
Sorry Bob, I thought you were refering to a chained object not one that you just want to populate.

I am guessing that you used to use this with the earlier version and that you are now trying to replicate that same functionality using ibirls3?

I haven't read through ibirls3.js as I did the previous two incarnations so I couldn't really tell you what the equivalent function is.

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 
December 21, 2010, 11:33 AM
rdmcnally
You are correct. This command was used earlier and now is not supported in ibirls3.

I saw a couple of your posts from Nov 2009 on this command. I was hoping you had figured out a way to do this using available ibirls3 commands.

I'll keep digging.

Thanks Tony.
December 21, 2010, 01:32 PM
MAdams1
Try putting the 'var' in like below....if that doesn't work you may need a different function for the populate...I tried using this populateDynamicCtrl() function with chained controls but it didn't work. Haven't tried it with non-chained controls. I'm no expert, just ask Tony.
//Begin function combobox1_onchange
function combobox1_onchange(ctrl) {
 var objCtrl = document.getElementById('combobox5');
populateDynamicCtrl(objCtrl);
}
//End function combobox1_onchange




WebFOCUS Server 8.1.05
Windows 2008 Server
WebFOCUS AppStudio 8.1.05
Windows 7 Professional
IE 11 and Chrome Version 43.0.2357.124 m.
Mostly HTML, PDF, Excel, and AHTML
December 21, 2010, 01:42 PM
MAdams1
Try this;

doRepopulateInputControls(ctrl.getAttribute('persistentuniqueid'));


WebFOCUS Server 8.1.05
Windows 2008 Server
WebFOCUS AppStudio 8.1.05
Windows 7 Professional
IE 11 and Chrome Version 43.0.2357.124 m.
Mostly HTML, PDF, Excel, and AHTML
December 22, 2010, 03:49 AM
Tony A
Bob,

I can see where Michelle is heading on this but the first question to ask is "how is your HTML coded?".

If it was constructed with the painter from your current release and contains all the necessary XML components towards the bottom of the code, then what Michelle suggests might work(?). This is because (from what I can see) the population of controls is now governed by the attribute "fromUniqueId"or similar and the relevant XML node to accompany it. The XML node would have content something like
<link linktype="default" from="xxxxxxxx"> which will be picked out using a pattern mask in the JavaScript of //input_controls/input_control[link[@from='xxxxxxxx']] where xxxxxxxx is the fromUniqueId value being passed.

However, if this code was created using a previous generator and/or hand coded then the likelyhood of all the necessary XML being present is in question.

If it is code from a previous release that you are just trying to get working with ibirls3.js then my advice would be - don't bother as ibirls2.js is included for backward compatability.

If you are still stuck then try and give us an idea of what you are trying to do.

ibirls3.js is 37% larger than ibirls2.js and the calls have been changed completely (as you have seen). There are many prototypes being created now and the code is not as straight forward as it's predecessor - hence my not having completely read through it!

If you have an example of what you are doing using one of the sample DBs then you can PM it to me and I'll see what I can recommend when I have time.

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 
December 22, 2010, 09:09 AM
Brian Suter
Attempting to reverse engineer IBI's run-time JS is a fools errand. It is designed to work for the HTML that is generated by the HTML composer. The tool generates inline DOM objects and a number of setup JS calls. You may discover that some subset of DOM/JS calls works now but that might change in the next bug fix.

If you want to use the functionality contained in IBIRLS3 (or 2), then use the tool and the documented JS calls. The undocumented calls are not guaranteed to work the same way from release to release. That is why they are NOT documented.

If you are currently using an undocumented JS call, please examine the documented ones and see if they fit your needs. If the undocumented call is fulfilling some unique need, then please open a case with CSS requesting the functionality be exposed as a published (and supported) function call.


Brian Suter
VP WebFOCUS Product Development
December 23, 2010, 07:56 AM
rdmcnally
First - Thank you all for your replies.

I have 4 combo boxes that are dynamically populated (PFD / Region / Sub-Region / Business Unit). The values come from Stored Procedures. I have a fifth combo box that I call Currency. This also calls a Stored Procedure passing to it values from the first four and returning up to 3 rows of data. None of these combo boxes are chained together.

When I initially launch the page the Currency box is being populated correctly with the values coming in.

My dilemma is this: I want to auto-populate the Currency combobox every time the user changes a value in the PFD, Region, Sub-Region, or Business Unit combo boxes. I understand from reading prior posts that the populateDynamicCtrl command did this in ibirls2. As we are in ibirls3 this command is no longer supported.

So I’m now looking for a way handle this in ibirls3.

Michelle - I tried using the doRepopulateInputControls(ctrl.getAttribute('persistentuniqueid'))command. It did not work. I didn't receive any error messages and the combo box was not refreshed. I may have coded this incorrectly. I found the uniqueid for the currency combobox and placed it in the command. Here is how I coded it:

//Begin function combobox3_onchange
function combobox3_onchange(ctrl) {
alert(ctrl);
doRepopulateInputControls(ctrl.getAttribute("compUid_9"))
alert('sreg');
}
//End function combobox3_onchange

This was based on the input_control bindcontrolid="compUid_9" found later in the code.

Is this correct?


Tony – This is a brand new HTML form I created in the past week using HTML Composer. Also – I’m not going to try to use any of the ibirls2 commands or backwards engineer anything. Too risky.

Brian – where can I find a copy of the documented js calls? I’ve been searching the web and haven’t had any luck so far. Even the command Michelle provided did not show up when searching through Google.

Again - Thanks for your help!
December 23, 2010, 08:56 AM
Tony A
quote:
I’m not going to try to use any of the ibirls2 commands or backwards engineer anything. Too risky.

With a new development then totally agree with you.

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 
December 27, 2010, 08:18 AM
MAdams1
I have the ibirls3.js saved as a text file if you want it...I could email it to you. I don't see any way to attach a file in the posts.


WebFOCUS Server 8.1.05
Windows 2008 Server
WebFOCUS AppStudio 8.1.05
Windows 7 Professional
IE 11 and Chrome Version 43.0.2357.124 m.
Mostly HTML, PDF, Excel, and AHTML
January 03, 2011, 07:46 AM
rdmcnally
That would be great.

Please send it to: rmcnally@lear.com

Thanks!
January 04, 2011, 07:30 AM
rdmcnally
Group,

Any ideas?

Bob
January 04, 2011, 08:28 AM
Tony A
Bob,

The ibirls3.js file is a readable file so you would only need to obtain it from the server, however, as Brian suggested, I would not advise using many calls directly. If Brian can supply a list of the useable calls that are supported then you may have further hope.

Having said that, what I would do for this question -
quote:
I want to auto-populate the Currency combobox every time the user changes a value in the PFD, Region, Sub-Region, or Business Unit combo boxes.
would be to build the request myself and execute the HTTP request, parsing the returned XML into the select control upon return.

A basic flow would be -
onchange event fired so collect the currently selected values in the relevant select controls.

build a URL into a variable called "request" (var request='/ibi_apps/WFServlet?IBIC_server=EDASERVE&IBIF_ex=[your fex]&var1=[value from control 1]&var2=[value from control 2] etc.)

process the URL using - var xmlDoc = getXml(request, true); which is an internal call that exists in ibirls2.s and ibirls3.js. Whether this is a supported call or not?

clear out the currency select control

take the resultant XML response and parse it as options into your currency select control

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 
January 05, 2011, 07:40 AM
rdmcnally
Tony,

Thanks for the suggestion.

Brian,

Would it be possible for you to supply a list of the useable calls that are supported? I'm trying to avoid re-engineering over a dozen reports as fixes & updates to the product are applied.

Thanks,

Bob
January 05, 2011, 09:52 AM
Francis Mariani
Brian mentions "use the tool and the documented JS calls" - where are these documented? I searched for ibirls2, ibirls3, populateDynamicCtrl and DoResetDownChainControls in the Technical Documentation Library and found nothing, my query was "too restrictive".

It's 2011 and the dawning of a new era, I'd like to try using the GUI development tools in Dev Studio, but I would like to see detailed documentation.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
January 05, 2011, 10:11 AM
MAdams1
If it helps, this is how I used the DoResetDownChainControls(ctrl) and it should be in the file I sent you. Michelle

//Begin function ResetSelects
function ResetSelects() {
 var ctrl = document.getElementById("LNcombobox");
 ctrl.selectedIndex = 0;
 DoResetDownChainControls(ctrl);
 onInitialUpdate();
}
//End function ResetSelects
 



WebFOCUS Server 8.1.05
Windows 2008 Server
WebFOCUS AppStudio 8.1.05
Windows 7 Professional
IE 11 and Chrome Version 43.0.2357.124 m.
Mostly HTML, PDF, Excel, and AHTML
January 05, 2011, 10:20 AM
rdmcnally
Michelle,

What is the trigger or event that calls the ResetSelects function?

I'm currently using the combobox3_onchange event.

Bob
January 05, 2011, 10:29 AM
MAdams1
Here is my html code.

<SCRIPT id=clientEventHandlersJS type=text/javascript>
//Begin function window_onload
function window_onload() {
 
UpdateData();
onInitialUpdate(); 
 
// TODO: Add your event handler code here
//add onInitialUpdate() function to make changes before initial run of the reports
}
//End function window_onload
 
 
//Begin function onInitialUpdate    sets focus to the last name combobox 
function onInitialUpdate() {
document.getElementById('LNcombobox').focus();
form1Reset_onclick(ctrl);
}
//End function onInitialUpdate
 
 
//Begin function ResetSelects
function ResetSelects() {
 var ctrl = document.getElementById("LNcombobox");
 ctrl.selectedIndex = 0;
 DoResetDownChainControls(ctrl);
 onInitialUpdate();
}
//End function ResetSelects
 
 
//Begin function form1Reset_onclick
function form1Reset_onclick(ctrl) {
window.top.frames.report1.location.href = 'about:blank'; 
ResetSelects();
onInitialUpdate();
}
//End function form1Reset_onclick
 


If you follow the calls to OnInitialUpdate(), it looks like an endless loop(at least it did to me) but it only works this way. I tried changing it up but came back to this as the only solution.


WebFOCUS Server 8.1.05
Windows 2008 Server
WebFOCUS AppStudio 8.1.05
Windows 7 Professional
IE 11 and Chrome Version 43.0.2357.124 m.
Mostly HTML, PDF, Excel, and AHTML
January 05, 2011, 10:31 AM
rdmcnally
If I implement this code then use the GUI Tool for later updates to the page, does anything get broken as a result?
January 05, 2011, 10:33 AM
MAdams1
quote:
//Begin function form1Reset_onclick function form1Reset_onclick(ctrl) { window.top.frames.report1.location.href = 'about:blank'; ResetSelects(); onInitialUpdate(); } //End function form1Reset_onclick


OOPS! I guess I do have one too many calls to
onInitialUpdate(). The one int he quote is not necessary. Doesn't hurt anything but not necessary.


WebFOCUS Server 8.1.05
Windows 2008 Server
WebFOCUS AppStudio 8.1.05
Windows 7 Professional
IE 11 and Chrome Version 43.0.2357.124 m.
Mostly HTML, PDF, Excel, and AHTML
January 05, 2011, 10:36 AM
MAdams1
I don't think it will. I have been switching back and forth to the GUI and it works. I have read in the WF Help files that they do not recommend a lot of custom code because they can not guarantee how it will work in future releases. I don't consider this is "custom" code. It's all stuff available to us to use and tweak.


WebFOCUS Server 8.1.05
Windows 2008 Server
WebFOCUS AppStudio 8.1.05
Windows 7 Professional
IE 11 and Chrome Version 43.0.2357.124 m.
Mostly HTML, PDF, Excel, and AHTML
January 05, 2011, 10:46 AM
MAdams1
This one is courtesy Tony A. I used this code in another procedure when I had multiple selects to reset.
 
//Begin function ResetSelects
function ResetSelects() {
       selectCol = document.getElementsByTagName("SELECT");
       for(i=0; i<selectCol.length; i++) {
          var el = selectCol[i];
          this.displayElement = document.getElementById(el.id);
          this.displayElement.selectedIndex = 0; 
       }
    }
//End function ResetSelects
 



WebFOCUS Server 8.1.05
Windows 2008 Server
WebFOCUS AppStudio 8.1.05
Windows 7 Professional
IE 11 and Chrome Version 43.0.2357.124 m.
Mostly HTML, PDF, Excel, and AHTML
January 05, 2011, 10:49 AM
rdmcnally
I'm very new to working with this code "behind the scenes". I've done 3+ dozen screens just using the GUI tool so I have another question.

Is the execution of this code tied to all dropdowns or events found on the screen?

If so, is there a way to restrict this to just the initial 4 dropdowns? I have several other dropdowns and radio buttons that have no impact to the Currency dropown box I'm trying to update.
January 05, 2011, 11:08 AM
MAdams1
The loop code I sent you was just an example. I would only use that if resetting all of your selects at the same time.
I went back and re-read your initial post and I appologize, I may have gotten us side tracked with resets. You have at least 2 comboboxes (1 and 5) and when 1 changes you want to populate 5...correct?


WebFOCUS Server 8.1.05
Windows 2008 Server
WebFOCUS AppStudio 8.1.05
Windows 7 Professional
IE 11 and Chrome Version 43.0.2357.124 m.
Mostly HTML, PDF, Excel, and AHTML
January 05, 2011, 11:10 AM
rdmcnally
There are 5 total. Each call a Stored Procedure for retriveing their values.

The values from the first 4 are used by the fifth to determine the values to return.

So my goal is to make the system refresh the fifth box anytime one of the first 4 are changed.
January 05, 2011, 11:17 AM
MAdams1
I did this in ASP.NET but not WF. I'll keep thinking.


WebFOCUS Server 8.1.05
Windows 2008 Server
WebFOCUS AppStudio 8.1.05
Windows 7 Professional
IE 11 and Chrome Version 43.0.2357.124 m.
Mostly HTML, PDF, Excel, and AHTML
January 05, 2011, 11:19 AM
MAdams1
And they can't be chained? Can someone make a selection of some and not all?


WebFOCUS Server 8.1.05
Windows 2008 Server
WebFOCUS AppStudio 8.1.05
Windows 7 Professional
IE 11 and Chrome Version 43.0.2357.124 m.
Mostly HTML, PDF, Excel, and AHTML
January 05, 2011, 11:37 AM
rdmcnally
I tried using the chaining but failed. I think because all 4 comboboxes values need to feed the fifth box.

To your second question - the user does not have to pick any values in any of the boxes. The boxes do come up with a *ALL option as a default from each Stored Procedure. That *ALL value behind *ALL is then passed to the report.