Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
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?
Go
New
Search
Notify
Tools
Reply
  
[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, 2005Reply With QuoteReport 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, 2005Reply With QuoteReport 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, 2005Reply With QuoteReport 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, 2005Reply With QuoteReport 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, 2005Reply With QuoteReport 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: 2327 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport 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, 2010Reply With QuoteReport 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, 2005Reply With QuoteReport This Post
  Powered by Social Strata  
 

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-2018 Information Builders, leaders in enterprise business intelligence.