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     [REOPENED] DS HTML Composer: onClick event for radio button

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[REOPENED] DS HTML Composer: onClick event for radio button
 Login/Join
 
Expert
posted
How do you add an onClick event handler for a radio button control?

The "control" is a set of three radio buttons. In HTML Composer, these are considered one control, hence only one onClick event handler in the Properties window - from the GUI you cannot add an event handler for an individual radiobutton.

This message has been edited. Last edited by: Francis Mariani,


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
Gold member
posted Hide Post
Add this to the control:
 onclick=RadioGroup_onclick(this) 


And add this function wherever you usually add the JavaScript:
 
function RadioGroup_onclick(ctrl)
	{
		if(RadioGroup_0.checked) 
		{
			// Do something
		}
		else if(RadioGroup_1.checked) 
		{
			// Do something else
		}
		else 
		{
			// Do something entirely different
		}
	} 


7.7.03, Windows 7, SQL Server 2005
 
Posts: 92 | Location: Carmel, IN | Registered: May 09, 2008Report This Post
Expert
posted Hide Post
I've been straightjacketed into using HTML Composer so I was hoping for a point-and-click solution.

I realize the only way is to modify the code, and you have to be careful where you place the onClick.

Thanks,


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
Expert
posted Hide Post
What HTML is generated in the page ?

Does it place the event on each radio button ?


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
No it doesn't. It places it in one of those proprietary tags.

I handcoded what I needed.


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
Expert
posted Hide Post
I think the proprietary tags will evaluate out to "Real" html.

I'm not on 7.7, but I'll have a look at what is realy generated.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
I have three radio buttons. When I attempted to use the GUI onClick, I determined that the function was called twice, I suppose for every button I did NOT click on - this is when I gave up.


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
Expert
posted Hide Post
In 7.6.6, if you click on the dropdown in the properties window, you can select each radio button.

So this is why there are two events firing.

One for the group, and another for the individual radio button.

This is what I was able to produce.

Hopefully its still in 7.7

<!-- Generated by Report Layout Painter -->
<HTML>
<HEAD>
<SCRIPT id=IBI_RelCallBack type=text/javascript>function AdjustChildrenPosition(){
}
</SCRIPT>

<SCRIPT id=IBI_OptionsScript type=text/javascript>
var rltVersion = "764";
var cgipath = "cgipath";
var ibirls = "ibirls2";

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_ibigbl src="/ibi_html/javaassist/ibi/html/js/ibigbl.js" type=text/javascript></SCRIPT>

<SCRIPT id=IBI_ibigblloadCss type=text/javascript>
ibigblloadCss(null);</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 radio1_0_onclick
function radio1_0_onclick(ctrl) {
alert(1);
}
//End function radio1_0_onclick

//Begin function radio1_1_onclick
function radio1_1_onclick(ctrl) {
alert(2);
}
//End function radio1_1_onclick

//Begin function radio1_2_onclick
function radio1_2_onclick(ctrl) {
alert(3);
}
//End function radio1_2_onclick

//Begin function radio1_onclick
function radio1_onclick(ctrl) {
alert('All');
}
//End function radio1_onclick
</SCRIPT>

<SCRIPT for=window eventname="onload">window.onload = function() { window_onload(); }</SCRIPT>
</HEAD>
<BODY style="OVERFLOW: auto" edaconnectionrequired="false">
<SPAN language=javascript id=radio1 contentEditable=false style="Z-INDEX: 1; LEFT: 80px; WIDTH: 280px; POSITION: absolute; TOP: 40px; HEIGHT: 90px" onclick=radio1_onclick(this) tabIndex=1 operation="NONE" name="radio1" columns="1">
<TABLE contentEditable=false style="WIDTH: 100%; HEIGHT: 100%" cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD>
<INPUT language=javascript id=radio1_0 onclick=radio1_0_onclick(this) type=radio value=Value1 name=radio1 displaytext="Value1">
<LABEL style="CURSOR: default" tabIndex=1 for=radio1_0>Value1</LABEL></TD></TR>
<TR>
<TD>
<INPUT language=javascript id=radio1_1 onclick=radio1_1_onclick(this) type=radio value=Value2 name=radio1 displaytext="Value2">
<LABEL style="CURSOR: default" tabIndex=1 for=radio1_1>Value2</LABEL></TD></TR>
<TR>
<TD>
<INPUT language=javascript id=radio1_2 onclick=radio1_2_onclick(this) type=radio value=Value3 name=radio1 displaytext="Value3">
<LABEL style="CURSOR: default" tabIndex=1 for=radio1_2>Value3</LABEL></TD></TR></TBODY></TABLE></SPAN>
<INPUT id=layoutinfo style="LEFT: -100px; POSITION: absolute; TOP: -100px" type=hidden inputcontrolids="radio1">
<INPUT id=ibiapp_app style="LEFT: -100px; POSITION: absolute; TOP: -100px" type=hidden value="focalpoint ibisamp baseapp" name=ibiapp_app></BODY>
<SCRIPT id=IBI_loader type=text/javascript>
doBeforeLoad();
</SCRIPT>
</HTML>


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Guru
posted Hide Post
We do not allow adding the event to an individual radio button because if it is dynamically populated, it is created on the fly and we have no idea how many there will be.

We would need it to be completely static in order for this to work.


David Glick
Director WebFOCUS App Studio
and WebFOCUS Developer Studio
WebFOCUS Division
Information Builders, Inc.
Direct (917) 339-5560
Voice Mail (212) 736-6250 x3560
Fax (212) 947-5168
Email david_glick@ibi.com
 
Posts: 315 | Registered: April 13, 2004Report This Post
Expert
posted Hide Post
quote:
We do not allow adding the event to an individual radio button


And yet, I was able add the events in DS 7.6.6, with point and click.

Confused


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
Aahh, in 7.7 you have removed the option of events on each radio button, even for static values.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
quote:
We do not allow adding the event to an individual radio button... We would need it to be completely static in order for this to work.


My radio button control is clearly marked as Static, by a radio button set called Data type.

Why does the onClick execute twice? Is this a bug, or this is by design? And if this is by design, please explain...

<HTML>
<HEAD>
<META id=mycharsetmeta content="text/html; charset=ISO-8859-1" http-equiv=Content-Type>
<META id=Generation content="Created in release 7702, 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 radio1_onclick
function radio1_onclick(ctrl) {
alert('radio1_onclick');
}
//End function radio1_onclick
</SCRIPT>

<SCRIPT for=window type=text/javascript eventname="onload">window.onload = function() { window_onload(); }</SCRIPT>
</HEAD>
<BODY style="OVERFLOW: auto" nextelementuniquenumber="1" thumbnailscale="4" elementtype="21" edaconnectionrequired="false">
<SPAN style="Z-INDEX: 1; POSITION: absolute; WIDTH: 130px; HEIGHT: 88px; TOP: 30px; LEFT: 240px" id=radio1 language=javascript tabIndex=1 contentEditable=false onclick=radio1_onclick(this) elementtype="12" defaultselection="1" persistentuniqueid="compUid_1" 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=1 value=Value1 type=radio noinput="0" displaytext="Value1" name="radio1">Value1</LABEL></TD></TR>
<TR>
<TD noWrap>
<LABEL style="CURSOR: default" id=radio1_LABEL_1 for=radio1_1>
<INPUT id=radio1_1 tabIndex=1 value=Value2 type=radio noinput="0" displaytext="Value2" name="radio1">Value2</LABEL></TD></TR>
<TR>
<TD noWrap>
<LABEL style="CURSOR: default" id=radio1_LABEL_2 for=radio1_2>
<INPUT id=radio1_2 tabIndex=1 value=Value3 type=radio noinput="0" displaytext="Value3" name="radio1">Value3</LABEL></TD></TR>
<TR>
<TD noWrap>
<LABEL style="CURSOR: default" id=radio1_LABEL_3 for=radio1_3>
<INPUT id=radio1_3 tabIndex=1 value=Value4 type=radio noinput="0" displaytext="Value4" name="radio1">Value4</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=temp type=hidden name="ibiapp_app">
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=ibic_server value=EDASER77 type=hidden isdataserversarea="1" name="ibic_server">
<xml id=focus_xmlelement>
<script type="text/xml" nextelementuniquenumber="2">
	
<rootxmlnode focoption="_FOC_NULL">
		
<variables></variables>
		
<input_controls>
			
<input_control bindcontrolid="compUid_1" elementtype="12" name="radio1" id="radio1" multiple="0" onetimepopulated="1">
				
<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" modifiedrequest="0">
							
<static_values>
								
<static value="Value1" display="Value1" selected="0" 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_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>


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
Expert
posted Hide Post
quote:
Originally posted by Francis Mariani:
[QUOTE]We do not allow adding the event to an individual radio button... We would need it to be completely static in order for this to work.


My radio button control is clearly marked as Static, by a radio button set called Data type.

Why does the onClick execute twice? Is this a bug, or this is by design? And if this is by design, please explain...

The following DS HTML Composer composed HTML page has one four-radio-button control with an onClick call to a function with an alert. Why does the alert pop up twice? How do I, in the DS HTML Composer world, figure out which one of the four radio buttons was clicked on? The alert displays "radio1" (twice) - nothing about the radio button actually clicked on?

<HTML>
<HEAD>
<META id=mycharsetmeta content="text/html; charset=ISO-8859-1" http-equiv=Content-Type>
<META id=Generation content="Created in release 7702, 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 radio1_onclick
function radio1_onclick(ctrl) {
alert('radio1_onclick ' + ctrl.name);
}
//End function radio1_onclick
</SCRIPT>

<SCRIPT for=window type=text/javascript eventname="onload">window.onload = function() { window_onload(); }</SCRIPT>
</HEAD>
<BODY style="OVERFLOW: auto" nextelementuniquenumber="1" thumbnailscale="4" elementtype="21" edaconnectionrequired="false">
<SPAN style="Z-INDEX: 1; POSITION: absolute; WIDTH: 130px; HEIGHT: 88px; TOP: 30px; LEFT: 240px" id=radio1 language=javascript tabIndex=1 contentEditable=false onclick=radio1_onclick(this) elementtype="12" defaultselection="1" persistentuniqueid="compUid_1" 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=1 value=Value1 type=radio noinput="0" displaytext="Value1" name="radio1">Value1</LABEL></TD></TR>
<TR>
<TD noWrap>
<LABEL style="CURSOR: default" id=radio1_LABEL_1 for=radio1_1>
<INPUT id=radio1_1 tabIndex=1 value=Value2 type=radio noinput="0" displaytext="Value2" name="radio1">Value2</LABEL></TD></TR>
<TR>
<TD noWrap>
<LABEL style="CURSOR: default" id=radio1_LABEL_2 for=radio1_2>
<INPUT id=radio1_2 tabIndex=1 value=Value3 type=radio noinput="0" displaytext="Value3" name="radio1">Value3</LABEL></TD></TR>
<TR>
<TD noWrap>
<LABEL style="CURSOR: default" id=radio1_LABEL_3 for=radio1_3>
<INPUT id=radio1_3 tabIndex=1 value=Value4 type=radio noinput="0" displaytext="Value4" name="radio1">Value4</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=temp type=hidden name="ibiapp_app">
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=ibic_server value=EDASER77 type=hidden isdataserversarea="1" name="ibic_server">
<xml id=focus_xmlelement>
<script type="text/xml" nextelementuniquenumber="2">
	
<rootxmlnode focoption="_FOC_NULL">
		
<variables></variables>
		
<input_controls>
			
<input_control bindcontrolid="compUid_1" elementtype="12" name="radio1" id="radio1" multiple="0" onetimepopulated="1">
				
<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" modifiedrequest="0">
							
<static_values>
								
<static value="Value1" display="Value1" selected="0" 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_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>


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
Guru
posted Hide Post
We stopped allowing this in 769 because in 769 westarted allowing chaining of statically populated controls so the values can change and become a different set of static values. In 768, the values were static and could never change.

You can create an onClick event for the entire control and then use the IbComposer_getCurrentSelection() api call to pass the selected value. You muct be at release 7702 or 7703 to have this functionality though.

Francis, I believe you manually modified the HTML page to create your onClick event and we do not support that. If you are at 7702 or 7703, please use the method I described above.


David Glick
Director WebFOCUS App Studio
and WebFOCUS Developer Studio
WebFOCUS Division
Information Builders, Inc.
Direct (917) 339-5560
Voice Mail (212) 736-6250 x3560
Fax (212) 947-5168
Email david_glick@ibi.com
 
Posts: 315 | Registered: April 13, 2004Report This Post
Expert
posted Hide Post
Thanks for the clarification David.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Virtuoso
posted Hide Post
quote:
Originally posted by David Glick:

[snip]

Francis, I believe you manually modified the HTML page to create your onClick event and we do not support that. If you are at 7702 or 7703, please use the method I described above.


But that method does not cover all applicable events. Some, such as onbeforeload and onafterload, are documented but do not appear in the list of the Events tab (in 7.7.03).

I suppose one can avoid editing the HTML tags directly, by letting javascript do the equivalent when the page is loaded --
function onInitialUpdate() {

  var node=document.getHtmlElementById('myid');
  node.onbeforeload= function(ctrl){ 
    ... 
  };

}
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Guru
posted Hide Post
In 7703, these events, onbeforeload and onafterload are protected from showing by a registry key. They will be surfaced in release 7704 and 80. For now you can set HKEY_CURRENT_USER\Software\Information
Builders\DeveloperStudio\77\FOCSHELL\WebFOCUS Developer
Studio\ResourceLayout\allowSpecialEvents to 1
and the events will display.

If you feel an event you would like is missing, please open a case with justification and we will look into adding it.


David Glick
Director WebFOCUS App Studio
and WebFOCUS Developer Studio
WebFOCUS Division
Information Builders, Inc.
Direct (917) 339-5560
Voice Mail (212) 736-6250 x3560
Fax (212) 947-5168
Email david_glick@ibi.com
 
Posts: 315 | Registered: April 13, 2004Report This Post
Expert
posted Hide Post
The code I posted above is a non manually modified HTML page created in HTML Composer from Dev Studio v7.7.03. As you can see in the code, the onClick is called once, from the span tag surrounding the three radio buttons. You can copy it and create an HTML Composer page. Why does the onClick function "radio1_onclick" get triggered twice?


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
Virtuoso
posted Hide Post
I noticed it fires 3 times in IE7 even...

I traced it in the console using Firebug and console-logging, changing the function implementation to:
function radio1_onclick(ctrl) {
	console.error('radio1_onclick ' + ctrl.id);
}


The trace is as follows:
- radio1_onclick radio1
  - radio1_onclick()                          franci...ons.htm (line 50)
    ctrl = span#radio1

console.error('radio1_onclick ' + ctrl.id);   franci...ons.htm (line 50)

- radio1_onclick radio1
  - radio1_onclick()                          franci...ons.htm (line 50)
    ctrl = span#radio1
    execute()                                 ibirls3.js (line 9453)
  - onclick()                                 ibirls3.js (line 11440)
    e = click clientX=279, clientY=42

console.error('radio1_onclick ' + ctrl.id);   franci...ons.htm (line 50) 


So, apparently some code in ibirls3.js decided to be smart and call the function again...

The relevant code from our ibirls3.js is here (implementation tends to differ between WF versions):
@9450/9454
Ib_eventHandlerObject.prototype.execute = function ()
{
    if(this.eventHandlerFunction)
        this.eventHandlerFunction.call(this.htmlControl);
}


@11404/11459
Ib_inputControlObject.prototype.prepareToRun = function(objNodeList)
{
    var nTabIndex = this.htmlInputControl.getAttribute('tabIndex');
    if (!nTabIndex)
        nTabIndex = this.htmlInputControl.getAttribute('tabIndexSaved');
    this.htmlInputControl.removeAttribute('tabIndex');
    this.htmlInputControl.setAttribute('tabIndexSaved', nTabIndex);
    var uniqueId = this.getName();
    var inputs = this.htmlInputControl.getElementsByTagName("INPUT");
    var object = this;
    var needToReselect = isLoadingFromSavedParamLocation() || bResetting;
    var listOfSelectedValues = [];
    for (var k = 0; k < objNodeList.length; k++)
    {
        if (objNodeList[k].selected)
            listOfSelectedValues.push(objNodeList[k]);
    }
    var bSpanHasEvent = getHtmlElementEventHandler(this.htmlInputControl, "onclick", this.htmlInputControl.onclick);
    var spanEvent = null;
    if (bSpanHasEvent)
        spanEvent = getHtmlElementEventHandler(this.htmlInputControl, "onclick", null);
    
    for (var j = 0; j < inputs.length; j++)
    {
        var temp = inputs[j];
        temp.setAttribute('tabIndex', nTabIndex);
        
        if (getHtmlElementEventHandler(temp, "onclick", temp.onclick) == true || spanEvent)
        {
            temp.onclick = function(e)
            {
                var element = e && e.target ? e.target : window.event.srcElement;
                var oldFuncObj = getHtmlElementEventHandler(element, "onclick", null);
                if (oldFuncObj)
                    oldFuncObj.execute();
                if (spanEvent)
/* here!! */        spanEvent.execute();
                OnResetDownChainControls(uniqueId, e);
            }
        }
        
        if (needToReselect)
        {
            var selected = false;
            for (var x = 0; x < listOfSelectedValues.length; x++)
            {
                if (temp.value == listOfSelectedValues[x].value)
                {
                    selected = true;
                    break;
                }
            }
            temp.checked = selected;
        }
    }
}


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
Virtuoso
posted Hide Post
Givem just the id of (the SPAN containing) a radiogroup, is there a simple means of determining the index of the checked radio button? Or, for that matter, the number of buttons within the group?

Using DS 7.7.03
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Virtuoso
posted Hide Post
That's a bit off-topic, really...
Anyway, you can find out with:
function radioInfo(radioId) {
	var span = document.getElementById(radioId);
	var radioList = span.getElementsByTagName('input');

	var length = radioList.length;
	var selected = -1;

	for (var i = 0; i < length; i++) {
		if (radioList[i].checked) {
			selected = i;
			break;
		}
	}

	alert('length: ' + length + ', selected: ' + selected);
}


That's assuming you don't add any other inputs to that radio-group (ones that aren't radio buttons of the same name), but that would probably break IBI handling of those items as well.

Unfortunately, due to the bug this topic is about, the first time this function gets called none of the radio buttons is checked yet.


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
Francis,

You will need to open a case to pursue this.


David Glick
Director WebFOCUS App Studio
and WebFOCUS Developer Studio
WebFOCUS Division
Information Builders, Inc.
Direct (917) 339-5560
Voice Mail (212) 736-6250 x3560
Fax (212) 947-5168
Email david_glick@ibi.com
 
Posts: 315 | Registered: April 13, 2004Report This Post
Expert
posted Hide Post
Wep5622, thanks for digging so deep into this issue. I am working on a short project with a very tight deadline and have no time to open tech support cases.


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
Virtuoso
posted Hide Post
Francis, did you ever get a solution to this stuff?

I was in need of something like that today and after banging my head and lots of trial-and-error (much more of the latter) I found a way to make it happen. See image:



So, the trick here is:

1) When selecting the group box in the GUI, a SPAN element gets chosen in the properties windows. We have to browse in the properties up to the main FIELDSET (groupbox) element tag that shields the radio buttons (in my example, that is the "gbDate" element).

2) Click the "events" tab, and add a new "onclick" event to the selected groupbox.

After a lot of fun (yeah, right), I managed to determine that even though the event must be created on the groupbox (because doing it in the SPAN element will cause a double-triggered event), we actually have to evaluate the value of the SPAN element itself ("pPeriod" in my example) to determine the selected value.

This is the piece of code:

//Begin function gbDate_onclick
function gbDate_onclick(ctrl) {

   // Get selected radio button's value
   var vPeriod = IbComposer_getCurrentSelection('pPeriod');

   if (vPeriod == 'RANGE') {
      // Do range stuff ...
      null;
   } else {
      // Do non-range stuff ...
      null;
   }
}
//End function gbDate_onclick



Hopefully this will save someone an afternoon of frustrations Roll Eyes



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Virtuoso
posted Hide Post
By the way, does someone know how to stop the Run/Submit event from running the report?

I need to add a few validations that need to be satisfied before the report runs. I added an 'onclick' event on the Run button that composer automatically creates with the form.

In the event handler I have my validation stuff but as soon as it finishes the target report is still invoked even when using the classic "return false;" statement in the function.

Is there perhaps an IbComposer_xyz function or variable or whatever that can be set to something so the submission stops when needed?

Hopefully I won't have to resort to creating a customized button to handle everything and then use "IbComposer_execute(....)". It's not necessarily "bad" but I may need to implement something similar or the Run Deferred and Scheduled buttons ...



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Expert
posted Hide Post
To paraphrase Steve Jobs, Developer Studio HTML Composer is "a bag of hurt".

I'll take a look at your suggestion regarding the radio buttons, meanwhile, here is what I've done for screen validation:

function myOnExecute(form)
{
submitFlag = true;

validateForm();

if (submitFlag)
  {
  OnExecute(form)
  }
}

function validateForm()
{
...
formObject1 = document.getElementById('combobox1');
...
if (formObject1.options[formObject1.selectedIndex].text == '!IBI.AMP.lsel_opt;...')
  {
  alert('!IBI.AMP.m_sel_reg;');
  formObject1.focus();
  submitFlag = false;
  }
...


Through trial and a Christmas stockingful of error, I discovered there is a difference between an HTML Composer screen designed with and without a form. With a form, you can intercept the submit in a normal fashion. I'll try to dig out my posting about this.


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
Virtuoso
posted Hide Post
Thanks Francis.

Where and how exactly do you invoke myOnExecute()? As an onclick event from the standard Run button created by HTML composer in the form or through a customized button of your own?

I ask because as soon as I click the Run button, even though my custom onclick event gets executed, the reports proceeds to be generated right after regardless of what I do in the function ... sorry, that behaviour is rather confusing and the only documentation I've found so far about Javascript use in HTML composer has no more than 10 pages and covers barely 6 to 10 functions ... none of them indicating how to intercept form submissions and stop them based on business logic. Just to clarify, I am using a form in the HTML document.

Hmmm, perhaps I have to create an "onsubmit" event in the form control itself and try the validation there with a "return false;" to stop it?

For some reason I thought that the product did not rely on standard form submission as defined by HTML but used instead IBI Javascript functions to parse the parameters, build the URL to invoke WFServlet + parameters and open a new document (window or iframe) using that.

I'll try the onsubmit approach next week to see if it makes a difference anyway.

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



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Expert
posted Hide Post
quote:
myOnExecute

Neftali,

I'm really sorry! That code is when you have a form Eeker

There's a long discussion here: Dev Studio GUI Newbie Question: Where to add form validation? and you may find a solution in there.

Mi dispiace!


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
Virtuoso
posted Hide Post
quote:
Just to clarify, I am using a form in the HTML document.


Hey Francis, no worries. I am indeed using a form and the link you provided confirmed that I needed to alter the "onsubmit" event and use instead a customized JS function which, after each validation is passed, should call "OnExecute(form);" to continue with the execution of the report -or- "return false;" to abort, and things are much better now.

No need for onclick events on the Run button at all.

I wonder what would happen when "Run Deferred" and the "Schedule" buttons are clicked? do they also cause a form submission and therefore my validation function gets used as well? I'll try to find sometime to test that but it is not a priority right now.

Thanks a bunch for the hint.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 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     [REOPENED] DS HTML Composer: onClick event for radio button

Copyright © 1996-2020 Information Builders