Focal Point Banner


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. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at myibi@ibi.com and provide your corporate email address, company, and name.


Connect to myibi
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Anyone removed 'ALL' from a drop down for a list containing only 1 item?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Anyone removed 'ALL' from a drop down for a list containing only 1 item?
 Login/Join
 
Guru
posted
I have an HTML document as a parameter page. On it is a drop down list which includes the 'ALL' option.

I'd like the ALL option to be there, but only when the list has more than one item. [What I mean is, if the drop down only has one choice, then ALL doesn't make sense for the user.]

Anyone ever do something like that?

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS Administrator @ Worldpay FIS
PROD/DEV/TEST: 8204, SANDBOX: 8206 soon - BIP, Reportcaster, Resource Manager, EUM, HyperStage soon, DB: HIVE,Oracle,MSSQL
 
Posts: 291 | Location: Greater Cincinnati  | Registered: May 11, 2005Report This Post
Expert
posted Hide Post
I assume you want an empty drop-down list.

If you created an HTML page using the App Studio GUI, you can probably use the IbComposer_removeSelectOption function and pass the "All" value. I haven't really used the GUI to create pages, so I can't tell you exactly where to place the code, but run this after the page has loaded.

If it's a beautifully hand-crafted HTML page, look here: Stack Overflow: Fastest way to remove all items from dropdown list or listbox?

You would be doing this when the length of the drop-down list is 1.

Pseudo-code:
if ( document.getElementById(controlID).options.length == 1 )
{
    IbComposer_removeSelectOption(controlID,arr["All"]);
}

or
if ( document.getElementById(controlID).options.length == 1 )
{
    document.getElementById(controlID).options.length = 0;
}

This message has been edited. Last edited by: Francis Mariani,


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Guru
posted Hide Post
quote:
IbComposer_removeSelectOption

quote:
You would be doing this when the length of the drop-down list is 1.


My mistake, there would be two items in the list. 'All' and 'Copay' or 'Long Term..' or etc.

Thank you, I'll take this out for a spin


WebFOCUS Administrator @ Worldpay FIS
PROD/DEV/TEST: 8204, SANDBOX: 8206 soon - BIP, Reportcaster, Resource Manager, EUM, HyperStage soon, DB: HIVE,Oracle,MSSQL
 
Posts: 291 | Location: Greater Cincinnati  | Registered: May 11, 2005Report This Post
Guru
posted Hide Post
I'm not sure what the problem is. I created a simple parameter screen in HTML doc. One drop down with the ALL option using MODEL from the car file.

Also I simplified the javascript to just remove the ALL option from the list and tried it in all of the following functions.

I found the reference searching the technical content library in the "Using JavaScript Code With HTML Canvas Pages". But the only hits I could find were 8.2 references.

http://documentation.informati...a1-A418-AA855AFF64A6



So, I must be using the IbComposwer_removeSelectionOption() wrong or, this doesn't work in 8.09.

Listing of the functions in my Embedded JavaScript/CSS window. I've moved the code around to each one to see if the event would make a difference. The code is shown here in the bottom function, onInitialUpdate(). Has anyone used this function successfully in v8.09 under HTML Composer?

  if(typeof(bRuntime) != 'undefined') {
// TODO: Add your inline runtime code here
}



//Begin function window_onload
function window_onload() {






UpdateData();


// 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 combobox1_ononafterload
function combobox1_ononafterload(ctrl) {


}
//End function combobox1_ononafterload


//Begin function combobox1_ononbeforeload
function combobox1_ononbeforeload(ctrl,arrValuesToLoad) {


}
//End function combobox1_ononbeforeload


//Begin function window_onInitialUpdate
function window_onInitialUpdate() {
}
//End function window_onInitialUpdate




//Begin function combobox1_onInitialUpdate
function combobox1_onInitialUpdate() {


}
//End function combobox1_onInitialUpdate






//Begin function onInitialUpdate
function onInitialUpdate() {

IbComposer_removeSelectOption("combobox1",arr["All"]);

}
//End function onInitialUpdate

This message has been edited. Last edited by: Don Garland,


WebFOCUS Administrator @ Worldpay FIS
PROD/DEV/TEST: 8204, SANDBOX: 8206 soon - BIP, Reportcaster, Resource Manager, EUM, HyperStage soon, DB: HIVE,Oracle,MSSQL
 
Posts: 291 | Location: Greater Cincinnati  | Registered: May 11, 2005Report This Post
Guru
posted Hide Post
quote:
I found the reference searching the technical content library in the "Using JavaScript Code With HTML Canvas Pages"



Found the 8009 version and it does not list the IbComposer_removeSelectOption function. Opened a case to confirm that it is supported or not.

http://infocenter.informationb...source%2Ftopic54.htm


WebFOCUS Administrator @ Worldpay FIS
PROD/DEV/TEST: 8204, SANDBOX: 8206 soon - BIP, Reportcaster, Resource Manager, EUM, HyperStage soon, DB: HIVE,Oracle,MSSQL
 
Posts: 291 | Location: Greater Cincinnati  | Registered: May 11, 2005Report This Post
Virtuoso
posted Hide Post
Assuming that your first (position = 0) option is the "All", then the following will remove it

document.getElementById("combobox1").remove(0);


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2410 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Gold member
posted Hide Post
Don,
Using AS 8009, I was able to have the following code do what you want.

 
   var lb = document.getElementById('listbox1');
   arrTexts = new Array();
   for(i=0; i < lb.length; i++)
    {
       if (lb.options[i].text == 'ALL' && lb.length == 2) {
           document.getElementById('listbox1').remove(i);
          }
       else {
        arrTexts[i] = lb.options[i].text;
            }
    }


Add this code to UpdateData() function so that when the page is loaded, this is executed first. One more thing, make sure 'ALL' is typed all upper case as JavaScript is case sensitive.

This message has been edited. Last edited by: SeyedG,
 
Posts: 90 | Location: Oklahoma City, Oklahoma | Registered: July 01, 2010Report This Post
Guru
posted Hide Post
quote:
document.getElementById("combobox1").remove(0);


This actually works but you need to refresh the controls to see it.


WebFOCUS Administrator @ Worldpay FIS
PROD/DEV/TEST: 8204, SANDBOX: 8206 soon - BIP, Reportcaster, Resource Manager, EUM, HyperStage soon, DB: HIVE,Oracle,MSSQL
 
Posts: 291 | Location: Greater Cincinnati  | Registered: May 11, 2005Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Anyone removed 'ALL' from a drop down for a list containing only 1 item?

Copyright © 1996-2020 Information Builders