[SOLVED] Anyone removed 'ALL' from a drop down for a list containing only 1 item?
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,
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.
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.
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,
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
September 25, 2017, 09:51 AM
SeyedG
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,
October 05, 2017, 01:52 PM
Don Garland
quote:
document.getElementById("combobox1").remove(0);
This actually works but you need to refresh the controls to see it.