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     [CLOSED] Calendar onChange event

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Calendar onChange event
 Login/Join
 
Gold member
posted
The calendar onChange event only seems to work when the user manually enters the date, not when they click on the icon and select a date.

Below is the javascript. Is there a workaround for this?

  
 function ddlStartEndTime_onchange(ctrl) {
 
 if (FromDate.value == ToDate.value){
 pnlStartEndTime.style.visibility = 'visible';
 gbDate.style.height = '150px';
 pnlOptional.style.top = '190px';
 }
 else
 {
 pnlStartEndTime.style.visibility = 'hidden';
 pnlOptional.style.top = '170px';
 gbDate.style.height = '120px';
 
 }
 }



Below is the HTML calendar inputs.

  

<INPUT id=FromDate title=!IBI.AMP.DATE_FORMAT_LBL; style="FONT-SIZE: 8pt;
 Z-INDEX: 8; LEFT: 220px; WIDTH: 80px; FONT-FAMILY: Arial; POSITION: absolute;
 TOP: 0px; HEIGHT: 20px" tabIndex=3 onFocus=ddlStartEndTime_onchange(this);
 size=5 name=FromDate operation="NONE" cacheruntimedata="0" elementtype="14"
 ibiformat="MDYY" calendardatatype="1" calendardata="0/0/-5;0/0/2">
 
 <INPUT id=ToDate title=!IBI.AMP.DATE_FORMAT_LBL; style="FONT-SIZE: 8pt; Z-INDEX:
 10; LEFT: 360px; WIDTH: 80px; FONT-FAMILY: Arial; POSITION: absolute; TOP: 0px;
 HEIGHT: 20px" tabIndex=4 onFocus=ddlStartEndTime_onchange(this); size=18
 name=ToDate operation="NONE" cacheruntimedata="0" elementtype="14"
 ibiformat="MDYY" calendardatatype="1" calendardata="0/0/-5;0/0/2"></SPAN>

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


WebFOCUS 8.0.08
Solaris
HTML, PDF, XLS, CSV
 
Posts: 55 | Registered: September 08, 2010Report This Post
Virtuoso
posted Hide Post
What happens when they click on the dates? Do they get an error? If so...what is it.
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Gold member
posted Hide Post
Nothing happens, the onChange event doesn't get called.


WebFOCUS 8.0.08
Solaris
HTML, PDF, XLS, CSV
 
Posts: 55 | Registered: September 08, 2010Report This Post
Virtuoso
posted Hide Post
Yeah, the date control doesn't seem to be quite complete and apparently contains a bug where it doesn't always apply the "right" date-formatting before posting it. Which brings me to the issue that there doesn't seem to be a way to specify what date-format it should be using at all, that's bound to cause problems sooner or later.
I don't know who implemented that control, but it almost seems like they stopped working on it half-way through...

I usually include below javascript for HTML forms that make use of the calendar control.
It overrides one of IBI's functions to change its behaviour. You may not need all of it, it's not entirely clean; I rolled my own event-attach function - there's probably one in the IBI code-base, but I didn't bother searching for it.

Still, it would be better if we'd get a complete implementation that handles

  • the onchange event when people type a date in the text field, and
  • for which you can specify what date-formats it should be using for displaying data and for posting data to the focus procedure handling the results (these are often different in my experience).


Right now we have to "parse" the posted date, as it can be in either of two formats!

// Event handler to add rawvalue after calendar field was changed by hand
function calendarChanged(obj, event) {
	obj.setAttribute("rawvalue", obj.value);
}

/*
 * Override WebFOCUS version with one adding an onchange event handler
 */
function setupDocCalendars()
{
	var coll = document.getElementsByTagName("INPUT");
	for( var i = 0; i < coll.length ; ++i )
	{
		oCtrl = coll[i];
		if(oCtrl.getAttribute("elementtype") != 14) continue;
		var ibiFormat = _getCalendarProperty(oCtrl, "ibiformat");
		if( isATextControl(oCtrl) &&
			0 == oCtrl.readOnly &&
			'none' != oCtrl.style.display &&
			'hidden' != oCtrl.style.visibility &&
			ibiFormat != null &&
			isYMDCombo(ibiFormat)
		) {
			setupCtrlCalendar( oCtrl, ibiFormat);
			addEventHandler(oCtrl, "change", calendarChanged);
		}
	}
	return;
}

function addEventHandler(obj, eventType, callback) {
	if (obj.addEventListener) {
		obj.addEventListener(
			eventType,
			function() { callback(obj, eventType); },
			false
		);
	} else if (obj.attachEvent) {
		obj.attachEvent(
			'on' + eventType,
			function() { callback(obj, eventType); }
		);
	}
}


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
Your onchange function is attached to the onFocus event .... you might want to mess with that a bit.


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report This Post
Gold member
posted Hide Post
Adding an onmousemove event to the BODY fixed this.


WebFOCUS 8.0.08
Solaris
HTML, PDF, XLS, CSV
 
Posts: 55 | Registered: September 08, 2010Report This Post
Expert
posted Hide Post
Hmmm, added the onmousemove event to the body tag, via point-and-click. The function called in this event function has an alert. As soon as I added the onmousemove event, I got an endless loop of alert - had to use Windows Task Manager to kill Dev Studio.


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
It looks like the following works in versions prior to v8:

Put the Calendar Control in a container and add an onmouseover event handler to the container.

I added the onmouseover event handler to the gold (Salmon?) panel.



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     [CLOSED] Calendar onChange event

Copyright © 1996-2020 Information Builders