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     IBCOMPOSER_SETCURRENTSELECTION javascript not working

Read-Only Read-Only Topic
Go
Search
Notify
Tools
IBCOMPOSER_SETCURRENTSELECTION javascript not working
 Login/Join
 
Master
posted
Hi,

I am trying to load the dropdown on click using the ibcomposer_setcurrentselection javascript function but it's not working.

I want to declare the dropdown as "Static" by default and when I click the button it should get populated.

How can I achieve this?

Please see the following sample code I am using.

<!-- Generated by Report Layout Painter -->
<!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 7703, 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="/ibihtml/javaassist/nls.js"></SCRIPT>

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

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

<SCRIPT id=IBI_ibigblloadCss type=text/javascript>
ibigblloadCss(null);
addIntlTranslatedJS("composertrans.js");
</SCRIPT>
<TITLE>HtmlPage</TITLE>
<SCRIPT id=clientEventHandlersJS type=text/javascript>
//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 button1_onclick
function button1_onclick(ctrl) {
alert("button1 click");
IbComposer_setCurrentSelection("TestDrop2",COUNTRY.value,true);
alert("done");
}
//End function button1_onclick
</SCRIPT>

<SCRIPT for=window type=text/javascript eventname="onload">window.onload = function() { window_onload(); }</SCRIPT>
</HEAD>
<BODY style="OVERFLOW: auto" name="TestDrop" nextelementuniquenumber="2" thumbnailscale="4" elementtype="21" edaconnectionrequired="true">
<SELECT style="Z-INDEX: 1; POSITION: absolute; WIDTH: 120px; TOP: 30px; LEFT: 40px" id=TestDrop tabIndex=1 defaultselection="1" persistentuniqueid="compUid_1" name="TestDrop"></SELECT>
<INPUT style="Z-INDEX: 2; POSITION: absolute; WIDTH: 110px; HEIGHT: 30px; TOP: 90px; LEFT: 120px" id=button1 language=javascript tabIndex=2 onclick=button1_onclick(this) value=Click type=button name="button1">
<SELECT style="Z-INDEX: 3; POSITION: absolute; WIDTH: 130px; TOP: 30px; LEFT: 200px" id=TestDrop2 tabIndex=3 defaultselection="1" persistentuniqueid="compUid_2" name="TestDrop2"></SELECT>
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=layoutinfo type=hidden>
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=ibiapp_app value="persistdir persist_mfd" type=hidden ismre="1" name="ibiapp_app">
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=ibif_ex value=app/test_dynamic_load.htm type=hidden name="ibif_ex">
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=IBIMR_domain value=persiste/persiste.htm type=hidden name="IBIMR_domain">
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=IBIMR_folder value=#testeohjy37h type=hidden name="IBIMR_folder">
<xml id=focus_xmlelement>
<script type="text/xml" nextelementuniquenumber="3">

<rootxmlnode focoption="_FOC_NULL">

<variables></variables>

<input_controls>

<input_control bindcontrolid="compUid_1" elementtype="8" name="TestDrop" id="TestDrop" multiple="0" onetimepopulated="0">

<link linktype="default" persistentuniqueid="compUid_1">

<condition default="1" name="Default" whattodowithcontrol="0" valuescompareoperator="0" parameterscompareoperator="0" conditionmultiselectoperator="0">

<data_info checkForDuplicateValues="0" sourcetype="typeMaster" datatype="1" modifiedrequest="0" ibiapp_app="persistdir persist_mfd" datasource="SAMPLEHOLD.mas" displayfield="SAMPLEHOLD.SEG01.COUNTRY" ibiformat="A10" dfformat="A10" datafield="SAMPLEHOLD.SEG01.COUNTRY" addalloption="1" dynalldisplayvalue="ALL" cacheruntimedata="1">
<![CDATA[TABLE FILE SAMPLEHOLD
SUM FST.SAMPLEHOLD.SEG01.COUNTRY
BY SAMPLEHOLD.SEG01.COUNTRY
-*insert_filters_here
ON TABLE PCHOLD FORMAT XML
END
]]></data_info></condition></link></input_control>
<input_control bindcontrolid="compUid_2" elementtype="8" name="TestDrop2" id="TestDrop2" multiple="0" onetimepopulated="0">
<link linktype="default" persistentuniqueid="compUid_2">
<condition default="1" name="Default" whattodowithcontrol="0" valuescompareoperator="0" parameterscompareoperator="0" conditionmultiselectoperator="0">
<data_info checkForDuplicateValues="0" sourcetype="typeMaster" datatype="1" modifiedrequest="0" datasource="SAMPLEHOLD.mas" displayfield="SAMPLEHOLD.SEG01.CAR" datafield="SAMPLEHOLD.SEG01.CAR" ibiapp_app="persistdir persist_mfd" ibiformat="A16" dfformat="A16" addalloption="1" dynalldisplayvalue="ALL" cacheruntimedata="1">
<![CDATA[TABLE FILE SAMPLEHOLD
SUM FST.SAMPLEHOLD.SEG01.CAR
BY SAMPLEHOLD.SEG01.CAR
-*insert_filters_here
ON TABLE PCHOLD FORMAT XML
END
]]></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>


WFConsultant

WF 8105M on Win7/Tomcat
 
Posts: 780 | Location: Florida | Registered: January 09, 2005Report This Post
Guru
posted Hide Post
If all you are wanting to do is not populate until the button is pressed then chain the button to the control and then have the action as populate. You could even hide the controls and then do a populate, show.

I know you can at least do something like this with a checkbox.

BTW, can you use car.mas in your sample code instead of samplehold so that it is easier to reproduce?


WebFOCUS 7.7.03/8.0.08
Dev Studio 7.7.03/8.0.08
App Studio 8.0.08
Windows 7
ALL Outputs
 
Posts: 402 | Location: Upland, IN | Registered: June 08, 2012Report This Post
Master
posted Hide Post
I don't want to populate it through chain but want to populate while clicking the button.

The samplehold is a CAR file. If you replace that with CAR, your dropdown should populate.


WFConsultant

WF 8105M on Win7/Tomcat
 
Posts: 780 | Location: Florida | Registered: January 09, 2005Report This Post
Guru
posted Hide Post
Alright, I assumed that you can chain from a button but you can only chain to a button.

I was able workaround this by having a hidden radio button. When the actual button is pressed, the hidden radio button is selected. The hidden radio button is chained to country to populate show.

The end result is that country is only populated when the button is pressed. Also, people generally want to change as little as possible when helping another person out, so I would say that you should change samplehold to car instead of the people trying to help you out unless you can't use car for some reason. Here is the code:
 
<HTML>
<HEAD>
<META id=mycharsetmeta content="text/html; charset=ISO-8859-1" http-equiv=Content-Type>
<META id=Generation content="Created in release 7703, 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 id=clientEventHandlersJS type=text/javascript>
//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 button1_onclick
function button1_onclick(ctrl) {
	IbComposer_setCurrentSelection('radio1', 'Y', true);
}
//End function button1_onclick
</SCRIPT>

<SCRIPT for=window type=text/javascript eventname="onload">window.onload = function() { window_onload(); }</SCRIPT>
</HEAD>
<BODY style="OVERFLOW: auto" nextelementuniquenumber="4" thumbnailscale="4" elementtype="21" edaconnectionrequired="true">
<SELECT style="Z-INDEX: 1; POSITION: absolute; WIDTH: 190px; TOP: 80px; LEFT: 140px" id=combobox1 tabIndex=1 defaultselection="1" persistentuniqueid="compUid_1" name="combobox1"></SELECT> 
<INPUT style="Z-INDEX: 2; POSITION: absolute; WIDTH: 190px; HEIGHT: 40px; TOP: 30px; LEFT: 140px" id=button1 language=javascript tabIndex=3 onclick=button1_onclick(this) value=Button type=button name="button1"> 
<SPAN style="Z-INDEX: 3; POSITION: absolute; WIDTH: 0px; DISPLAY: none; HEIGHT: 0px; TOP: 80px; LEFT: 140px" id=radio1 tabIndex=4 contentEditable=false elementtype="12" defaultselection="1" persistentuniqueid="compUid_4" groupChildren="1" columns="1" name="radio1">
<TABLE style="WIDTH: 100%; HEIGHT: 100%" contentEditable=false cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD noWrap>
<LABEL style="CURSOR: default" id=radio1_LABEL_0 for=radio1_0>
<INPUT id=radio1_0 tabIndex=4 value=Y type=radio noinput="0" displaytext="Y" name="radio1">Y</LABEL></TD></TR></TBODY></TABLE></SPAN>   
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=layoutinfo type=hidden>
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=ibiapp_app value=josh_hapner 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="6">
	
<rootxmlnode focoption="_FOC_NULL" top="20" left="627" width="150" height="130">
		
<variables></variables>
		
<input_controls>
			
<input_control bindcontrolid="compUid_1" elementtype="8" name="combobox1" id="combobox1" multiple="0" inbinding="1" top="175" left="187" width="60" height="20" onetimepopulated="0">
				
<link linktype="default" persistentuniqueid="compUid_1" from="compUid_4">
					
<condition default="1" name="Default" whattodowithcontrol="0" valuescompareoperator="0" parameterscompareoperator="0" conditionmultiselectoperator="0">
						
<data_info checkForDuplicateValues="0" sourcetype="typeMaster" datatype="1" modifiedrequest="0" ibiapp_app="josh_hapner" datasource="CAR.mas" displayfield="CAR.ORIGIN.COUNTRY" ibiformat="A10" dfformat="A10" datafield="CAR.ORIGIN.COUNTRY">
							
<![CDATA[TABLE FILE CAR
SUM FST.CAR.ORIGIN.COUNTRY
 BY CAR.ORIGIN.COUNTRY
-*insert_filters_here
ON TABLE PCHOLD FORMAT XML
END
]]></data_info></condition></link></input_control>
			
<input_control bindcontrolid="compUid_4" elementtype="12" name="radio1" id="radio1" multiple="0" onetimepopulated="1" inbinding="1">
				
<link linktype="default" persistentuniqueid="compUid_5">
					
<condition default="1" name="Default" whattodowithcontrol="0" valuescompareoperator="0" parameterscompareoperator="0" conditionmultiselectoperator="0">
						
<data_info checkForDuplicateValues="0" sourcetype="typeMaster">
							
<static_values>
								
<static value="Y" display="Y" 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>
 


WebFOCUS 7.7.03/8.0.08
Dev Studio 7.7.03/8.0.08
App Studio 8.0.08
Windows 7
ALL Outputs
 
Posts: 402 | Location: Upland, IN | Registered: June 08, 2012Report This Post
Expert
posted Hide Post
I've chronicled the problems I have with IbComposer_setCurrentSelection. Meanwhile, the so-called API functions are poorly documented. To use IbComposer_setCurrentSelection with multiple values, they have to be in a JavaScript array, this is how I call it:

IbComposer_setCurrentSelection('P_REPORT_DIMENSIONS', P_REPORT_DIMENSIONS_array)


Here's what I have done in the past: I create a hidden (Display: Do Not Display) listbox in HTML Composer and have this point to the data. The visible listbox has no data properties. The button has an onclick event handler.

In the example below I use normal javaScript to copy the option values in the hidden listbox (temporarily made visible) to the visible listbox. I hope this helps a bit.

<!-- Generated by Report Layout Painter -->
<!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 7703, 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 id=clientEventHandlersJS type=text/javascript>
//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 button1_onclick
function button1_onclick(ctrl) {
//alert("button1 click");

// Copy options from hidden listbox to visible listbox

document.getElementById('TestDrop2').options.length = 0;

for (var i = 0; i < document.getElementById('TestDrop2_hidden').options.length; i++)
    {
    TestDrop2_option = document.getElementById('TestDrop2_hidden').options[i];
    document.getElementById('TestDrop2').options[i] = new Option(TestDrop2_option.text, TestDrop2_option.value);
    }

//alert("button1 click done");
}
//End function button1_onclick
</SCRIPT>

<SCRIPT for=window type=text/javascript eventname="onload">window.onload = function() { window_onload(); }</SCRIPT>
</HEAD>
<BODY style="OVERFLOW: auto" name="TestDrop" nextelementuniquenumber="4" thumbnailscale="4" elementtype="21" edaconnectionrequired="true">
<SELECT style="Z-INDEX: 1; POSITION: absolute; WIDTH: 120px; TOP: 30px; LEFT: 40px" id=TestDrop tabIndex=1 defaultselection="1" persistentuniqueid="compUid_1" name="TestDrop"></SELECT>
<INPUT style="Z-INDEX: 2; POSITION: absolute; WIDTH: 110px; HEIGHT: 30px; TOP: 90px; LEFT: 120px" id=button1 language=javascript tabIndex=2 onclick=button1_onclick(this) value=Click type=button name="button1">
<SELECT style="Z-INDEX: 3; POSITION: absolute; WIDTH: 130px; TOP: 30px; LEFT: 200px" id=TestDrop2 tabIndex=3 defaultselection="1" persistentuniqueid="compUid_2" name="TestDrop2"></SELECT>
<SELECT style="POSITION: absolute; WIDTH: 230px; TOP: 140px; LEFT: 500px" id=TestDrop2_hidden tabIndex=4 size=1 defaultselection="1" persistentuniqueid="compUid_4" name="TestDrop2_hidden"></SELECT>
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=layoutinfo type=hidden>
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=ibiapp_app value=management type=hidden ismre="1" name="ibiapp_app">
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=ibif_ex value=app/fp_kamesh1.htm type=hidden name="ibif_ex">
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=IBIMR_domain value=manageme/manageme.htm type=hidden name="IBIMR_domain">
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=IBIMR_folder value=#zfmarianitem type=hidden name="IBIMR_folder">
<xml id=focus_xmlelement>
<script type="text/xml" nextelementuniquenumber="5">

<rootxmlnode focoption="_FOC_NULL">

<variables></variables>

<input_controls>

<input_control bindcontrolid="compUid_1" elementtype="8" name="TestDrop" id="TestDrop" multiple="0" onetimepopulated="0">

<link linktype="default" persistentuniqueid="compUid_1">

<condition default="1" name="Default" whattodowithcontrol="0" valuescompareoperator="0" parameterscompareoperator="0" conditionmultiselectoperator="0">

<data_info checkForDuplicateValues="0" sourcetype="typeMaster" datatype="1" modifiedrequest="0" ibiapp_app="persistdir persist_mfd" datasource="CAR.mas" displayfield="CAR.SEG01.COUNTRY" ibiformat="A10" dfformat="A10" datafield="CAR.SEG01.COUNTRY" addalloption="1" dynalldisplayvalue="ALL" cacheruntimedata="1">

<![CDATA[TABLE FILE CAR
SUM FST.CAR.SEG01.COUNTRY
 BY CAR.SEG01.COUNTRY
-*insert_filters_here
ON TABLE PCHOLD FORMAT XML
END
]]></data_info></condition></link></input_control>

<input_control bindcontrolid="compUid_2" elementtype="8" name="TestDrop2" id="TestDrop2" multiple="0" onetimepopulated="1">

<link linktype="default" persistentuniqueid="compUid_2">

<condition default="1" name="Default" whattodowithcontrol="0" valuescompareoperator="0" parameterscompareoperator="0" conditionmultiselectoperator="0">

<data_info checkForDuplicateValues="0" sourcetype="typeMaster" datatype="0" modifiedrequest="0" datasource="CAR.mas" displayfield="CAR.SEG01.CAR" datafield="CAR.SEG01.CAR" ibiapp_app="persistdir persist_mfd" ibiformat="A16" dfformat="A16" addalloption="1" dynalldisplayvalue="ALL" cacheruntimedata="1">

<![CDATA[]]></data_info></condition></link></input_control>
<input_control bindcontrolid="compUid_4" elementtype="8" name="TestDrop2_hidden" id="TestDrop2_hidden" multiple="0" onetimepopulated="0">
<link linktype="default" persistentuniqueid="compUid_4">
<condition default="1" name="Default" whattodowithcontrol="0" valuescompareoperator="0" parameterscompareoperator="0" conditionmultiselectoperator="0">
<data_info checkForDuplicateValues="0" sourcetype="typeMaster" datatype="1" modifiedrequest="0" ibiapp_app="management" datasource="CAR.mas" displayfield="COUNTRY" datafield="COUNTRY" ibiformat="A10" dfformat="A10" addalloption="1" dynalldisplayvalue="ALL">
<![CDATA[TABLE FILE CAR
SUM FST.COUNTRY
 BY COUNTRY
-*insert_filters_here
ON TABLE PCHOLD FORMAT XML
END
]]></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>





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, 2005Report 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     IBCOMPOSER_SETCURRENTSELECTION javascript not working

Copyright © 1996-2020 Information Builders