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.
There IS now a "selected value" box that you can specify what you would like as the selected/highlighted value in your drop-down box. !IBI.AMP.varname as opposed to DefaultText does NOT work. In fact, I've been trying alternatives I've found here for 2 days now. None of them work. It would make life SOOOO much simpler if an &variable did work there.
Having said that,
Using a fex to create and set default content of the control, how DO I create a list and set the default (WITHOUT movin the default to the top of the list?
Thanks for any help you can provide!! ps. I am NOT a javascript programmer. I am not afraid to insert a little in there if that works, but need specifics.This message has been edited. Last edited by: mpbMDE,
That won't work in 7.6.11. The listbox hasn't finished populating yet when the onload function gets called.
Besides, it is a very rough simplification, it just selects the 2nd item in the listbox, which is not what you want.
Try this (off the top of my head):
function onInitialUpdate() {
document.getElementById("listbox1").value = "!IBI.AMP.varname;";
}
The important part here is that the code to set the default for the dropdown is in onInitialUpdate(), a function called by the IBI libraries after the contents of the form-elements are loaded (which happens asynchronously since 7.6.10 or so, which just means different parts of the page are downloaded in parallel using multiple connections, but the consequence is that it's not as cut-and-dry when the page has finished loading).
Setting a dropdown boxes' value directly (like I did above) doesn't work in IE6, but it should work in later versions (and other browsers). If you're cursed with IE6, you'll need to iterate through the list of options in the dropdown box until you find the one with the right value, and set it's "selected"-attribute to some value (doesn't matter what, even "false" means true there). For help with Javascript, I can recommend the Core Javascript Guide at mozilla.
Also noteworthy, "listbox1" in above example refers to the id-attribute of your dropdown form-element (see the properties panel), not to its name-attribute - that seems to be a common mistake among WebFOCUS users. And... that attribute has to be unique in your HTML page, of course.
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010 : Member of User Group Benelux :
I inserted this: function onInitialUpdate() { document.getElementById("combobox1").value = "!IBI.AMP.MYCAR;"; } into my HTML. Then I get NO values in my dropdown box.
Here is my fex that is populating the dropdown box: -* File defaultcar.fex -SET &MYCAR = 'TR7';
TABLE FILE CAR SUM FST.MODEL BY MODEL NOPRINT WHERE COUNTRY EQ 'ENGLAND'; ON TABLE SET HOLDLIST PRINTONLY ON TABLE PCHOLD FORMAT XML END I want the &MYCAR value selected as the default. Marilyn
I may be mistaken, but if the variable name being used to indicate the default is the same name as the variable that the listbox is also tied to, the listbox should automatically set the value so long as it actually exists in the list.
Since your having issues with this though, I may be wrong.
In any event, the following could be added to the onInitialUpdate() to set the correct item.
var list = document.getElementById('combobox1');
for(var i=0; i<list.length; i++)
{
if(list[i].value == '!IBI.AMP.VARNAME;')
list.selectedIndex = i;
}
WebFOCUS 8.1.04; SQL Server 2012; Windows 7; Windows Server 2012 R2;
Originally posted by mpbMDE: Here is my fex that is populating the dropdown box: -* File defaultcar.fex -SET &MYCAR = 'TR7';
TABLE FILE CAR SUM ...
That's the wrong place to set the default value, you need to do that in the fex that includes your HTML page (where you put -HTMLFORM).
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010 : Member of User Group Benelux :
That's the wrong place to set the default value, you need to do that in the fex that includes your HTML page (where you put -HTMLFORM).
Aha That's why this method doesn't work. The launch page is opened by another application, via the URL. That leaves me with no solution again. Is there a way to do this in the fex that populates the dropdown box? I have seen many variations of the following:
I don't know if I am off base here, but if you always want the &MYCAR var to be TR7 just hard code it in the HTML page like below;
function onInitialUpdate() {
var list = document.getElementById('combobox1');
for(var i=0; i<list.length; i++)
{
if(list[i].value == 'TR7')
list.selectedIndex = i;
}
}
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
Thanks MAdams1!! I did get this to work. I just changed the 'TR7' to '!IBI.AMP.MODEL;'. The other thing I did was to make the starting object starthere.fex that simply has this in it: -* File starthere.fex -SET &MODEL = 'TR7'; -HTMLFORM LAUNCH_CAR.htm --------------------------- Now all I have to do is get the incoming &MODEL value from the source. The source is in the URL that starts the fex starthere.fex.