Focal Point
[SOLVED] Can't get combobox to be focus on load

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/3627037395

November 15, 2010, 05:22 PM
MAdams1
[SOLVED] Can't get combobox to be focus on load
I would appreciate any help.
I have an html launch page with a panel that has
4 combo boxes, a search button and reset button. I have set the tab order to be 1-4 being the combo boxes(first is LastNameCB) and the search button being 6 and reset button is 7. I have tried putting LastNameCB.focus() in the window_onload function and also checked out both links below and tried those examples as well. No matter what I do, the search button is the focus on load. Help please!

http://www.wrapapp.com]www.wrapapp.com
http://www.srl.co.il]www.srl.co.il

I'm using WB 7.7 and Dev Studio

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
November 16, 2010, 08:43 AM
ABT
Add your code after the UpdateData() function. This works for me.

Juicy bits (Bolding is a sanity check in my test):
<SCRIPT id=clientEventHandlersJS type=text/javascript>
//Begin function window_onload
function window_onload() {

UpdateData();
 
document.getElementById('combobox1').focus();

document.getElementById('combobox1').style.fontWeight="900";

// TODO: Add your event handler code here
//add onInitialUpdate() function to make changes before initial run of the reports
}
//End function window_onload
</SCRIPT>



Full File (displayed via the Text Editor):
<!-- Generated by Report Layout Painter -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META id=mycharsetmeta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
<META id=Generation content="Created in release 7611, 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 src="/ibi_html/javaassist/nls.js" type=text/javascript></SCRIPT>

<SCRIPT id=IBI_nlsVars src="/ibi_html/javaassist/nlsvars.js" type=text/javascript></SCRIPT>

<SCRIPT id=IBI_ibigbl src="/ibi_html/javaassist/ibi/html/js/ibigbl.js" type=text/javascript></SCRIPT>

<SCRIPT id=IBI_ibigblloadCss type=text/javascript>
ibigblloadCss(null);
addIntlTranslatedJS("composertrans.js");
</SCRIPT>
<TITLE>HtmlPage</TITLE>
<META content="MSHTML 6.00.6000.17063" name=GENERATOR>
<SCRIPT id=clientEventHandlersJS type=text/javascript>
//Begin function window_onload
function window_onload() {

UpdateData();
 
document.getElementById('combobox1').focus();

document.getElementById('combobox1').style.fontWeight="900";

// TODO: Add your event handler code here
//add onInitialUpdate() function to make changes before initial run of the reports
}
//End function window_onload
</SCRIPT>

<SCRIPT for=window type=text/javascript eventname="onload">window.onload = function() { window_onload(); }</SCRIPT>
</HEAD>
<BODY style="OVERFLOW: auto" persistentuniqueid="compUid_1" nextelementuniquenumber="7" elementtype="21" edaconnectionrequired="false">
<SELECT id=combobox1 style="Z-INDEX: 1; LEFT: 180px; WIDTH: 250px; POSITION: absolute; TOP: 100px" tabIndex=1 persistentuniqueid="compUid_2" name="combobox1"> 
<OPTION value=Value1 selected noinput="0" displaytext="Value1">Value1</OPTION> 
<OPTION value=Value2 noinput="0" displaytext="Value2">Value2</OPTION> 
<OPTION value=Value3 noinput="0" displaytext="Value3">Value3</OPTION> 
<OPTION value=Value4 noinput="0" displaytext="Value4">Value4</OPTION> 
<OPTION value=Value5 noinput="0" displaytext="Value5">Value5</OPTION> 
<OPTION value=Value6 noinput="0" displaytext="Value6">Value6</OPTION></SELECT> 
<SELECT id=listbox1 style="Z-INDEX: 2; LEFT: 180px; WIDTH: 250px; POSITION: absolute; TOP: 140px; HEIGHT: 54px" tabIndex=2 size=3 persistentuniqueid="compUid_3" name="listbox1"> 
<OPTION value=Value1 selected noinput="0" displaytext="Value1">Value1</OPTION> 
<OPTION value=Value2 noinput="0" displaytext="Value2">Value2</OPTION> 
<OPTION value=Value3 noinput="0" displaytext="Value3">Value3</OPTION> 
<OPTION value=Value4 noinput="0" displaytext="Value4">Value4</OPTION> 
<OPTION value=Value5 noinput="0" displaytext="Value5">Value5</OPTION> 
<OPTION value=Value6 noinput="0" displaytext="Value6">Value6</OPTION> 
<OPTION value=Value7 noinput="0" displaytext="Value7">Value7</OPTION></SELECT> 
<INPUT id=edit1 style="Z-INDEX: 3; LEFT: 180px; WIDTH: 250px; POSITION: absolute; TOP: 70px" tabIndex=3 persistentuniqueid="compUid_4" name="edit1"> 
<INPUT id=edit2 style="Z-INDEX: 4; LEFT: 180px; WIDTH: 250px; POSITION: absolute; TOP: 40px" tabIndex=4 persistentuniqueid="compUid_5" name="edit2"> 
<INPUT id=button1 style="Z-INDEX: 5; LEFT: 320px; WIDTH: 110px; POSITION: absolute; TOP: 200px; HEIGHT: 30px" tabIndex=5 type=button size=14 value=Button persistentuniqueid="compUid_6" name="button1"> 
<INPUT id=button2 style="Z-INDEX: 6; LEFT: 180px; WIDTH: 110px; POSITION: absolute; TOP: 200px; HEIGHT: 30px" tabIndex=6 type=button size=14 value=Button persistentuniqueid="compUid_7" name="button2">      
<INPUT id=layoutinfo style="LEFT: -100px; POSITION: absolute; TOP: -100px" type=hidden>
<INPUT id=IBIMR_domain style="LEFT: -100px; POSITION: absolute; TOP: -100px" type=hidden value=woblaker/woblaker.htm name="IBIMR_domain">
<INPUT id=IBIMR_folder style="LEFT: -100px; POSITION: absolute; TOP: -100px" type=hidden value=#testbwiifx2a name="IBIMR_folder">
<INPUT id=ibif_ex style="LEFT: -100px; POSITION: absolute; TOP: -100px" type=hidden value=app/focus_test.htm name="ibif_ex">
<INPUT id=ibiapp_app style="LEFT: -100px; POSITION: absolute; TOP: -100px" type=hidden ismre="1" name="ibiapp_app">
<xml id=focus_xmlelement>
<script type="text/xml">
	
<rootxmlnode top="50" left="10" width="150" height="130">
		
<variables></variables>
		
<input_controls>
			
<input_control bindcontrolid="compUid_2" elementtype="8" name="combobox1" id="combobox1" multiple="0" top="20" left="30" width="60" height="20" inbinding="1" onetimepopulated="1">
				
<link linktype="default">
					
<condition default="1" name="Default" whattodowithcontrol="0" valuescompareoperator="0" parameterscompareoperator="0" conditionmultiselectoperator="0">
						
<data_info sourcetype="typeMaster" modifiedrequest="1">
							
<static_values>
								
<static value="Value1" display="Value1" selected="1" noinput="0"></static>
								
<static value="Value2" display="Value2" selected="0" noinput="0"></static>
								
<static value="Value3" display="Value3" selected="0" noinput="0"></static>
								
<static value="Value4" display="Value4" selected="0" noinput="0"></static>
								
<static value="Value5" display="Value5" selected="0" noinput="0"></static>
								
<static value="Value6" display="Value6" selected="0" noinput="0"></static></static_values></data_info></condition></link></input_control>
			
<input_control bindcontrolid="compUid_3" elementtype="9" name="listbox1" id="listbox1" multiple="0" top="20" left="140" width="60" height="20" inbinding="1" onetimepopulated="1">
				
<link linktype="default">
					
<condition default="1" name="Default" whattodowithcontrol="0" valuescompareoperator="0" parameterscompareoperator="0" conditionmultiselectoperator="0">
						
<data_info sourcetype="typeMaster" modifiedrequest="1">
							
<static_values>
								
<static value="Value1" display="Value1" selected="1" noinput="0"></static>
								
<static value="Value2" display="Value2" selected="0" noinput="0"></static>
								
<static value="Value3" display="Value3" selected="0" noinput="0"></static>
								
<static value="Value4" display="Value4" selected="0" noinput="0"></static>
								
<static value="Value5" display="Value5" selected="0" noinput="0"></static>
								
<static value="Value6" display="Value6" selected="0" noinput="0"></static>
								
<static value="Value7" display="Value7" selected="0" noinput="0"></static></static_values></data_info></condition></link></input_control>
			
<input_control bindcontrolid="compUid_4" elementtype="7" name="edit1" id="edit1" multiple="0" onetimepopulated="1" top="20" left="250" width="60" height="20" inbinding="1">
				
<link linktype="default">
					
<condition default="1" name="Default" whattodowithcontrol="0" valuescompareoperator="0" parameterscompareoperator="0" conditionmultiselectoperator="0">
						
<data_info accept="0" sourcetype="typeMaster">
							
<static_values>
								
<static value="" display="" selected="0" noinput="0"></static></static_values></data_info></condition></link></input_control>
			
<input_control bindcontrolid="compUid_5" elementtype="7" name="edit2" id="edit2" multiple="0" onetimepopulated="1" top="20" left="360" width="60" height="20" inbinding="1">
				
<link linktype="default">
					
<condition default="1" name="Default" whattodowithcontrol="0" valuescompareoperator="0" parameterscompareoperator="0" conditionmultiselectoperator="0">
						
<data_info accept="0" sourcetype="typeMaster">
							
<static_values>
								
<static value="" display="" selected="0" noinput="0"></static></static_values></data_info></condition></link></input_control></input_controls>
		
<other_bound_objects></other_bound_objects>
		
<requests></requests></rootxmlnode></script>
</xml></BODY>
<SCRIPT id=IBI_loader type=text/javascript>
doBeforeLoad();
</SCRIPT>
</HTML>


- ABT


------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro
November 17, 2010, 09:33 AM
MAdams1
Thank you for the code. It was helpful to look through. However, for some reason I still can not get the combobox to have focus, it did the font weight line but not the focus. I have autocomplete code as well, at first I thought maybe that was causing a problem. Then I put the .focus() code into another launch page that didn't have the autocomplete code and it still does not give focus to the combobox. I don't get it.


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
November 17, 2010, 09:39 AM
MAdams1
I also tried deleting the search button and still does not give focus to the combobox.


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
November 17, 2010, 10:47 AM
MAdams1
SOLVED----

I guess it helps to read the help files......this worked like a charm for my focus issue.

FROM HELP FILES:

If you want JavaScript to run after a page loads completely, but before any reports are executed, you need to create a function called onInitialUpdate() and put your code in that function. Your code should be added inline in the HTM file after the line:
//End function window_onload


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