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.

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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Setting focus to a listbox vs dropdown box

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Setting focus to a listbox vs dropdown box
 Login/Join
 
Guru
posted
Is there a difference when setting the focus to a listbox as opposed to a dropdown box?? I have been using this code
//for dropdown box
document.getElementById('dropdown1').focus();
//for listbox
document.getElementById('listbox1').focus();

in the onInitialUpdate() function which is called from form1Reset_onclick(ctrl) event to set focus to a dropdown box. When I use this exact code for a listbox, it does not work. I have ensured that the element name is correct, I don't see why it won't work.
I also had to do a work around for clearing the report(IFrame). What I have used previously would not work.
//Instead of:
window.top.frames.report1.location.href= 'about:blank';
//I had to use this:
document.getElementById('report1').src= "";
document.form.reset();

Another thing I have been wondering about is, when I use the .focus() I have to call the form1Reset_onclick(ctrl) from the onInitialUpdate() to get it to work. I have tested it with and without it. In code it looks like an endless loop to me.
Here is all of my HTML code I am referencing;

<SCRIPT id=clientEventHandlersJS type=text/javascript>
//Begin function window_onload
function window_onload() {
 
UpdateData();
onInitialUpdate();
 
// 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 onInitialUpdate()
function onInitialUpdate() {
document.getElementById('listbox1').focus();
form1Reset_onclick(ctrl);
}
//End function onInitialUpdate()
 
 
//Begin function MailButton_onclick
function MailButton_onclick(ctrl) {
// TODO: Add your event handler code here
OnExecute(ctrl)
}
//End function MailButton_onclick
 
 
//Begin function RoomButton_onclick
function RoomButton_onclick(ctrl) {
// TODO: Add your event handler code here
OnExecute(ctrl)
}
//End function RoomButton_onclick
 
 
//Begin function form1Reset_onclick
function form1Reset_onclick(ctrl) {
document.getElementById('report1').src= "";
document.form.reset(); 
onInitialUpdate();
}
//End function form1Reset_onclick
</SCRIPT>



<INPUT style="BACKGROUND-IMAGE: url(/ibi_html/javaassist/ibi/html/describe/reset.gif); Z-INDEX: 21; POSITION: absolute; BACKGROUND-COLOR: white; WIDTH: 38px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 22px; TOP: 85px; LEFT: 418px" id=form1Reset language=javascript tabIndex=3 onclick=form1Reset_onclick(this) value=" " type=reset StyleBack_UserSuppliedFullPath="1" name="reset1"> 


Any help would be appreciated.
Thanks

This message has been edited. Last edited by: Kerry,


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
 
Posts: 272 | Location: Kalamazoo, Michigan | Registered: September 30, 2010Report This Post
Virtuoso
posted Hide Post
quote:
Originally posted by MAdams1:
I have ensured that the element name is correct, I don't see why it won't work.


The element name-attribute is irrelevant, you should be referring to the element id. That's what getElementById() looks at.


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 :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Guru
posted Hide Post
Sorry, I guess I should have been more specific. The name and id are the same.


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
 
Posts: 272 | Location: Kalamazoo, Michigan | Registered: September 30, 2010Report This Post
Guru
posted Hide Post
The only way I can get this to work is to take out my code and call UpdateData() from the reset buttons on click event. But I don't really like this because the screen flashes when it reloads. I just don't get why my code works in other launch pages but not this one.


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
 
Posts: 272 | Location: Kalamazoo, Michigan | Registered: September 30, 2010Report This Post
Virtuoso
posted Hide Post
quote:
Originally posted by MAdams1:
[code]
//Begin function window_onload
function window_onload() {

UpdateData();
onInitialUpdate();

^^^^^^^
Don't do that. onInitialUpdate is called by WebFOCUS already. The window onload event can be too early to call that function.

You also created an endless loop between onInitialUpdate and form1Reset_onclick.

Lastly; What browser are you using for testing? I've seen some strange behaviours with IE6.


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 :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Guru
posted Hide Post
Okay, I didn't know that onInitialUpdate() was called by WF automatically. I took that out of the window_onload() function. I thought it looked like an endless loop but the .focus() code doesn't work without calling form1Reset_onclick event from the onInitialUpdate()function.
I am testing on IE8.


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
 
Posts: 272 | Location: Kalamazoo, Michigan | Registered: September 30, 2010Report This Post
Guru
posted Hide Post
Okay, looks like it is trying to set focus to the listbox however it selects the last item selected in the listbox. I need it to select the first item in the list. All the code I have tried doesn't work.


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
 
Posts: 272 | Location: Kalamazoo, Michigan | Registered: September 30, 2010Report This Post
Virtuoso
posted Hide Post
That's not done by calling focus(), but by setting the selectedIndex property of the listbox to 0.

Focus() determines which item in the form is the active item, which is usually used to set focus to a text-input box to help people who start typing right away.


You may want to look into why by default the last option in your listbox gets selected. Maybe the 'selected'-attribute is set on all the options? Mind that selected="false" means the same as selected="true", namely that it's selected.

What does the generated HTML for that listbox look like?


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 :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Guru
posted Hide Post
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META id=mycharsetmeta content="text/html; charset=ISO-8859-1" http-equiv=Content-Type>
<META id=Generation content="Created in release 7701, Generation 3.0">
<SCRIPT id=IBI_RelCallBack type=text/javascript>function AdjustChildrenPosition(){
}
</SCRIPT>
 
<SCRIPT id=IBI_OptionsScript type=text/javascript>
var cgipath = "cgipath";
var ibirls = "ibirls3";
 
var rltdyncalendar = "rltdyncalendar";
var gmap = "ibigmap";
var olap="olap";
var olappanebase="olappanebase";
var olapdrill="olapdrill";
 
var ibixmltree="ibixmltree";
 
var ibiOptions = new Array(cgipath,ibirls);
</SCRIPT>
 
<SCRIPT id=IBI_nls type=text/javascript src="/ibi_html/javaassist/nls.js"></SCRIPT>
 
<SCRIPT id=IBI_nlsVars type=text/javascript src="/ibi_html/javaassist/nlsvars.js"></SCRIPT>
 

<SCRIPT id=IBI_ibigbl type=text/javascript src="/ibi_html/javaassist/ibi/html/js/ibigbl.js"></SCRIPT>
 
<SCRIPT id=IBI_ibigblloadCss type=text/javascript>
ibigblloadCss(null);
addIntlTranslatedJS("composertrans.js");
</SCRIPT>
<TITLE>HtmlPage</TITLE>
<SCRIPT>
// Programmer:  Michelle Adams
// Date:  January 12, 2011
//------------------------------------------------------------------------
// Program Purpose: Produces a PDF output of employees by class code
//                  with the option to generate a csv file of address
//                  labels by mailing address and/or room
//------------------------------------------------------------------------
// Output type: HTML
//-------------------------------------------------------------------------
// Confidentiality Indicator used: No
//-------------------------------------------------------------------------
// Dead Indicator used: Yes in fex
//-------------------------------------------------------------------------
// Other Procedures/Files: employee_by_classcode.fex,
//                         address_labels_mailing_address.fex,
//                         address_labels_room.fex
//-------------------------------------------------------------------------
// Parameters: ClassCode by description
//-------------------------------------------------------------------------
// Tables: none
//-------------------------------------------------------------------------
// UPDATES:
//
//
//-------------------------------------------------------------------------
</SCRIPT>
 
<SCRIPT id=clientEventHandlersJS type=text/javascript>
//Begin function window_onload
function window_onload() {
 
UpdateData();
//onInitialUpdate();
 
// 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 onInitialUpdate()
function onInitialUpdate() {
var obj= document.getElementById('listbox1');
obj.selectedIndex=0;
obj.focus();            //just trying to get 'ALL' to show highlighted blue like it does on page load
 
 
}
//End function onInitialUpdate()
 
 
//Begin function MailButton_onclick
function MailButton_onclick(ctrl) {
// TODO: Add your event handler code here
OnExecute(ctrl)
}
//End function MailButton_onclick
 
 
//Begin function RoomButton_onclick
function RoomButton_onclick(ctrl) {
// TODO: Add your event handler code here
OnExecute(ctrl)
}
//End function RoomButton_onclick
 
 
//Begin function form1Reset_onclick
function form1Reset_onclick(ctrl) {
onInitialUpdate();
document.getElementById('listbox1').focus();
document.getElementById('listbox1').option.value = 'ALL';
//UpdateData();
 
}
//End function form1Reset_onclick
</SCRIPT>
 
<SCRIPT for=window type=text/javascript eventname="onload">window.onload = function() { window_onload(); }</SCRIPT>
</HEAD>
<BODY style="Z-INDEX: 0; OVERFLOW: auto" elementtype="21" thumbnailscale="4" edaconnectionrequired="true" nextelementuniquenumber="11">

<IMG style="Z-INDEX: 1; POSITION: absolute; WIDTH: 310px; HEIGHT: 110px; TOP: 10px; LEFT: 10px" id=image1 tabIndex=6 border=0 src="insidetoplogo.jpg" originalWidth="350" originalHeight="139" name="image1">
<LABEL style="Z-INDEX: 2; POSITION: absolute; WIDTH: 360px; FONT-FAMILY: Verdana; HEIGHT: 40px; FONT-SIZE: 18pt; TOP: 60px; CURSOR: default; FONT-WEIGHT: bold; LEFT: 320px" id=label1 tabIndex=7>Employees by Class Code </LABEL>
<SPAN style="Z-INDEX: 4; POSITION: absolute; BACKGROUND-COLOR: black; WIDTH: 100%; HEIGHT: 8px; FONT-SIZE: 1pt; TOP: 280px; LEFT: 10px" id=line1 tabIndex=9 elementtype="5" defaultselection="1"></SPAN>
<IFRAME style="Z-INDEX: 5; POSITION: absolute; WIDTH: 100%; HEIGHT: 540px; OVERFLOW: auto; TOP: 290px; LEFT: 10px" id=report1 title=employee_by_classcode1.fex tabIndex=10 src="" frameBorder=no elementtype="2" autoExecute="false" requests_list="0" WIDTHOLD="1334" HEIGHTOLD="540" persistentuniqueid="compUid_5" name="report1"></IFRAME>
<FIELDSET style="Z-INDEX: 0; POSITION: absolute; BACKGROUND-COLOR: #dcdcdc; WIDTH: 100%; FONT-FAMILY: Verdana; HEIGHT: 140px; FONT-SIZE: 10pt; TOP: 130px; LEFT: 10px" id=groupbox1>
<LABEL style="Z-INDEX: 14; POSITION: absolute; WIDTH: 620px; FONT-FAMILY: Verdana; HEIGHT: 50px; FONT-SIZE: 10pt; TOP: 10px; CURSOR: default; LEFT: 350px" id=label3 tabIndex=18>This report produces a printable pdf of employees by class code with the option of
<BR>generating address labels for the mailing address and/or room.</LABEL>
<INPUT style="Z-INDEX: 18; POSITION: absolute; BACKGROUND-COLOR: white; WIDTH: 240px; FONT-FAMILY: Verdana; HEIGHT: 35px; COLOR: #0091cc; FONT-SIZE: 10pt; TOP: 90px; FONT-WEIGHT: bold; LEFT: 940px" id=RoomButton language=javascript tabIndex=5 onclick=RoomButton_onclick(this) value="Generate Room Number Labels" type=button defaultselection="1" autoExecute="false" requests_list="11" name="RoomButton">
<INPUT style="Z-INDEX: 18; POSITION: absolute; BACKGROUND-COLOR: white; WIDTH: 260px; FONT-FAMILY: Verdana; HEIGHT: 35px; COLOR: #0091cc; FONT-SIZE: 10pt; TOP: 90px; FONT-WEIGHT: bold; LEFT: 660px" id=MailButton language=javascript tabIndex=4 onclick=MailButton_onclick(this) value="Generate Mailing Address Labels" type=button defaultselection="1" autoExecute="false" requests_list="10" name="MailButton"> </FIELDSET>
<FORM style="Z-INDEX: 19; POSITION: absolute; WIDTH: 670px; HEIGHT: 120px; TOP: 140px; LEFT: 20px" id=form1 onsubmit="OnExecute(this);return false;" method=post requests_list="0" form_dist_between_desc_and_input="10" form_hor_dist_between_controls="10" vert_dist_between_controls="10" form_number_of_columns="4" form_number_of_visible_rows="4" form_prompt_location="1" default_slider_type="4" form_newline_chain="1" form_type="1" fexlist_list="report1" tempwidth="337" tempheight="142" name="form1">
<INPUT style="Z-INDEX: 20; POSITION: absolute; BACKGROUND-COLOR: white; WIDTH: 112px; BACKGROUND-REPEAT: no-repeat; FONT-FAMILY: Verdana; HEIGHT: 35px; COLOR: #0091cc; FONT-SIZE: 11pt; TOP: 83px; FONT-WEIGHT: bold; LEFT: 345px" id=form1Submit tabIndex=2 value=Submit size=52 type=submit defaultselection="1" name="ITEM1">
<INPUT style="Z-INDEX: 21; POSITION: absolute; BACKGROUND-COLOR: white; WIDTH: 112px; BACKGROUND-REPEAT: no-repeat; FONT-FAMILY: Verdana; HEIGHT: 35px; COLOR: #0091cc; FONT-SIZE: 11pt; TOP: 83px; FONT-WEIGHT: bold; LEFT: 488px" id=form1Reset language=javascript tabIndex=3 onclick=form1Reset_onclick(this) value=Reset size=57 type=reset defaultselection="1" name="reset1">

<LABEL style="Z-INDEX: 23; POSITION: absolute; WIDTH: 315px; FONT-FAMILY: Verdana; HEIGHT: 15px; FONT-SIZE: 10pt; TOP: 5px; CURSOR: default; FONT-WEIGHT: bold; LEFT: 5px" id=label4 tabIndex=22 for=listbox1 name="listbox1">Choose a class code description</LABEL>
<SELECT style="Z-INDEX: 24; POSITION: absolute; WIDTH: 300px; FONT-FAMILY: Verdana; HEIGHT: 86px; FONT-SIZE: 10pt; TOP: 34px; LEFT: 5px" id=listbox1 tabIndex=1 multiple size=3 defaultselection="1" persistentuniqueid="compUid_11" boundtovariable="1" defaultlocation="0,0,54,300" name="listbox1"></SELECT></FORM>
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=layoutinfo type=hidden resourcectrlids="image1">
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=ibiapp_app value=michelle type=hidden name="ibiapp_app">
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=ibic_server value=EDASERVE type=hidden isdataserversarea="1" name="ibic_server">
<xml id=focus_xmlelement>
<script type="text/xml" nextelementuniquenumber="14">
 
<rootxmlnode focoption="_FOC_NULL" top="100" left="10" width="150" height="130">
 
<variables>
 
<variable controltype="9" parametercreatedinreslay="0" type="default" desc="CLASSCODE" name="CLASSCODE" default="ALL" textvarname="" accept="0" select="1" create="1" top="70" left="30" width="60" height="20" inbinding="1">
 
<link linktype="default" persistentuniqueid="compUid_7" from="compUid_11">
 
<condition default="1" name="Default" whattodowithcontrol="4" valuescompareoperator="0" parameterscompareoperator="0" conditionmultiselectoperator="0">
 
<data_info checkForDuplicateValues="0" displayfield="PEOPLE_EMPLOYMENT_HISTORY_DIM.PEOPLE_EMPLOYMENT_HISTORY_DIM.EMPLOYEE_ECLS_DESC" datafield="PEOPLE_EMPLOYMENT_HISTORY_DIM.PEOPLE_EMPLOYMENT_HISTORY_DIM.EMPLOYEE_ECLS_DESC" datasource="people_employment_history_dim.mas" datatype="1" selectedvalue="ALL" operation="OR" slider_range_from="" slider_range_to="" linktype="none" sourcetype="typeMaster" ibiformat="A30V">
 
<static_values>
 
<static value="ALL" display="ALL" selected="1" noinput="0"></static></static_values></data_info></condition></link>
 
<requestid id="10"></requestid>
 
<requestid id="11"></requestid>
 
<requestid id="0"></requestid></variable></variables>
 
<input_controls>
 
<input_control bindcontrolid="compUid_11" elementtype="9" requiredfield="0" name="listbox1" id="listbox1" multiple="1" onetimepopulated="0">
 
<link linktype="default" persistentuniqueid="compUid_13">
 
<condition default="1" name="Default" whattodowithcontrol="0" valuescompareoperator="0" parameterscompareoperator="0" conditionmultiselectoperator="0">
 
<data_info checkForDuplicateValues="1" datatype="1" datasource="people_employment_history_dim.mas" datafield="PEOPLE_EMPLOYMENT_HISTORY_DIM.PEOPLE_EMPLOYMENT_HISTORY_DIM.EMPLOYEE_ECLS_DESC" displayfield="PEOPLE_EMPLOYMENT_HISTORY_DIM.PEOPLE_EMPLOYMENT_HISTORY_DIM.EMPLOYEE_ECLS_DESC" addalloption="1" sourcetype="typeMaster" cacheruntimedata="0" dynalldisplayvalue="ALL" ibiformat="A30V" dfformat="A30V" accept="0" selectedvalue="ALL" operation="OR" modifiedrequest="1" dosorting="1">
 
<![CDATA[TABLE FILE people_employment_history_dim
SUM FST.PEOPLE_EMPLOYMENT_HISTORY_DIM.PEOPLE_EMPLOYMENT_HISTORY_DIM.EMPLOYEE_ECLS_DESC
 BY PEOPLE_EMPLOYMENT_HISTORY_DIM.PEOPLE_EMPLOYMENT_HISTORY_DIM.EMPLOYEE_ECLS_DESC
WHERE PEOPLE_EMPLOYMENT_HISTORY_DIM.PEOPLE_EMPLOYMENT_HISTORY_DIM.EMPLOYEE_ECLS_DESC OMITS 'Pre FY'
ON TABLE PCHOLD FORMAT XML
END
]]></data_info></condition></link></input_control></input_controls>
 
<other_bound_objects></other_bound_objects>
 
<requests nextrequestsid="13">
 
<request requestid="0" targettype="iframe" targetname="report1" sourcetype="typeFex" ibif_ex="employee_by_classcode1.fex" ibiapp_app="michelle" activereport="0" reportcolumns=""></request>
 
<request requestid="10" sourcetype="typeFex" targettype="iframe" targetname="report1" ibif_ex="address_labels_mailing_address.fex" activereport="0" reportcolumns="" ibiapp_app="michelle"></request>
 
<request requestid="11" sourcetype="typeFex" targettype="iframe" targetname="report1" ibif_ex="address_labels_room.fex" activereport="0" reportcolumns="" ibiapp_app="michelle"></request>
  </requests></rootxmlnode></script>
</xml></BODY>
<SCRIPT id=IBI_loader type=text/javascript>
doBeforeLoad();
</SCRIPT>
</HTML>


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
 
Posts: 272 | Location: Kalamazoo, Michigan | Registered: September 30, 2010Report This Post
Guru
posted Hide Post
quote:
document.getElementById('listbox1').focus();



oops forgot to take out this line of code from the reset_onclick event
and the next line too........having a day...


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
 
Posts: 272 | Location: Kalamazoo, Michigan | Registered: September 30, 2010Report 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] Setting focus to a listbox vs dropdown box

Copyright © 1996-2020 Information Builders