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.
In the HTML Composer, I have a listbox with multiple selections available. The items in the listbox are populated using an external procedure, based on selections by the user and some database fields.
I want to add a button to the page allowing the user to click on it and all the check boxes would get selected. I know that I can add an "ALL" option to the list, but my intention is to allow the user to have all boxes checked, so they can deselect rows.
In the HTML Composer documentation, I found IbComposer_setCurrentSelection, which looks like it would apply here, but the only example in the documentation hard-codes the values to be set. In my case, the list is not determined until run time, so I wouldn't think that I could hard-code the values.
I imagine that I need to dynamically populate the array used in the function's parameters, but I have no clue how to do that.
Any thoughts / suggestions would be appreciated.This message has been edited. Last edited by: bsullivan,
WebFOCUS 8.0.0.2 Windows, All Outputs
Posts: 27 | Location: Philadelphia, PA | Registered: January 21, 2013
The list I'm trying to manipulate is a checkbox, not a listbox. If I changed the type to listbox, both pieces of code worked. But when they were check boxes, I was getting an error message of "unable to get property 'length' of undefined or null reference"
function checkAll(frm, checkedOn) {
// have we been passed an ID
if (typeof frm == "string") {
frm = document.getElementById(frm);
}
// Get all of the inputs that are in this form
var inputs = frm.getElementsByTagName("input");
// for each input in the form, check if it is a checkbox
for (var i = 0; i < inputs.length; i++) {
if (inputs[i].type == "checkbox") {
inputs[i].checked = checkedOn;
}
}
}
//Begin function button1_onclick
function button1_onclick(ctrl) {
checkAll('listbox1', true);
}
//End function button1_onclick
Thanks again for the assistance, as I would have never figured out what to search for without the suggestions.
Brendan
WebFOCUS 8.0.0.2 Windows, All Outputs
Posts: 27 | Location: Philadelphia, PA | Registered: January 21, 2013
That works unless you have other check boxes. I set the relevent checkboxes to have a certain ID and then checked or unchecked on click:
//Begin function radio1_0_onclick
//Function to select all fields
//Field ids are hard coded looking like field1_0
function radio1_0_onclick(ctrl) {
var inputElems = document.getElementsByTagName("input");
for (var i=0; i<inputElems.length; i++) {
var first5 = inputElems[i].id.slice(0,5);
if (inputElems[i].type === "checkbox" && first5 === "field") {
inputElems[i].checked = true;
}
}
}
//End function radio1_0_onclick
//Begin function radio1_1_onclick
function radio1_1_onclick(ctrl) {
var inputElems = document.getElementsByTagName("input");
for (var i=0; i<inputElems.length; i++) {
var first5 = inputElems[i].id.slice(0,5);
if (inputElems[i].type === "checkbox" && first5 === "field") {
inputElems[i].checked = false;
}
}
}
//End function radio1_1_onclick
WebFOCUS 7.7.03/8.0.08 Dev Studio 7.7.03/8.0.08 App Studio 8.0.08 Windows 7 ALL Outputs
Posts: 402 | Location: Upland, IN | Registered: June 08, 2012
I haven't worked with a parameter screen that uses a set of checkboxes to populate one control - what would happen if there are too many to display? Are these checkboxes contained in a scrollable container?
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
I do think that if there are too many in there, it will add a scroll bar to the screen and I am going to try and avoid that. The list in question is a list of billing reports that can be run & the user can select any number of them to be run together. By dynamically generating the list, it's easier to add reports (because they just need to be added to a database table instead of modifying the HTML page) and easier to disable reports (by using a flag on the database table).
I assume that we could run into a problem eventually if we add enough reports that the originally set space is too small, but based on the number of reports that have been added over the past few years, I'm comfortable saying that we would be OK with this approach.
J,
At this point, we just have the one set of check boxes on the screen, but I'll definitely keep that in mind for the future.
WebFOCUS 8.0.0.2 Windows, All Outputs
Posts: 27 | Location: Philadelphia, PA | Registered: January 21, 2013
Are you looking for something like the image below? Where the radio button toggles the checks to either "All" or "None" of them? The Run button will run a report which works with the values. I set the values of the checkboxes to their checkbox number for clarity.
This message has been edited. Last edited by: Doug,
In FOCUS Since 1983 ~ from FOCUS to WebFOCUS. Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005
Add a processing loop to the executed fex like this:
-REPEAT EndOfLoop FOR &CNTR FROM 1 TO 9 ;
-IF &CheckBox&CNTR.EVAL NE &CNTR THEN GOTO EndOfLoop ;
-TYPE *** Processing the fex which is associated with Checkbox &CheckBox&CNTR.EVAL
-EndOfLoop
for even more fun. and get something like this:
*** 1 3 5 7 9 *** &ToggleCBs=All ***
*** Processing the fex which is associated with Checkbox 1
*** Processing the fex which is associated with Checkbox 3
*** Processing the fex which is associated with Checkbox 5
*** Processing the fex which is associated with Checkbox 7
*** Processing the fex which is associated with Checkbox 9
This message has been edited. Last edited by: Doug,
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005
Yes, that image is fairly close to what I envision, although instead of All / None radio buttons, I'm thinking about using a button to select all and another button to unselect all.
I already have the logic working for running the selected reports in place, which is doing something similar to what you provided (and it's always good to see that the idea I came up with matches what others come up with).
Thanks for the help!
WebFOCUS 8.0.0.2 Windows, All Outputs
Posts: 27 | Location: Philadelphia, PA | Registered: January 21, 2013
I see that this is "[SOLVED]", so, you're well on your way. I revised the screenshot based on your last post. Of course the radio buttons could be deselected when a user changes any of the checkboxes by added JS code to them.
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005