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     Calendar Control Events

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Calendar Control Events
 Login/Join
 
Platinum Member
posted
IN resource layout painter the calendar Control Events don't seem to work. The on change event is only executed if you manually change the text after the calendar entry is selected. What I would like to do is execute some code when the user clicks on a date. Does anyone know how to do this?

Thank you very much
 
Posts: 103 | Location: ricmmond va | Registered: September 30, 2004Report This Post
<InfoSystems>
posted
The reason the onChange event won't fire is because the Date textbox is actaully being changed by the calendar function in the WebFOCUS Client's script library.

onChange events only respond to User initiated actions and the value being added or changed by the Calendar function is technically "script initiated" not User initiated.

Note: The same thing happens for dynamic select lists populated using the Procedure or Datasource options. An associated onChange event won't fire when the User changes the dynamically populated select list because the list was originally generated by a js function in the WebFOCUS Client library.

You can get the desired behavior in both cases by writing another function that keeps track of the last value of the Date (or select list) element (using hidden elements) and constantly checks for changes. You tie the "monitor" function to an onMousemove event associated with the Body.

Any mouse movement at all triggers the "monitor" function so the values are checked frequently and will most certainly get checked immediately after the User selects the Date from the calendar (or changes the selected item) by moving the mouse.

You include an if-statement in the function that triggers the target function (the other code you want to execute) whenever the value of the calendar-controlled Date differs from the "tracking" value.

The almost constant User-initated mouse movements over the body causes the "montitor" function to check frequently, but no action triggers until an inequality is detected. The end result is the desired "onChange" behavior that you are seeking!
 
Report This Post
Expert
posted Hide Post
Hi Bob,

The onFocus event does work with the calendar controls (despite it being created by a JS function) and I use it to tie two date controls together. I assign an attribute called dateoffset that is used in a JavaScript to work out what the date in the clicked control should be in relation to the "parent" date control -

<!-- Report Date Selection -->
<INPUT id=ITEM3 dateoffset=31 .......... etc.>
<INPUT id=ITEM4 dateoffset=1 onFocus="SetEndDate('ITEM3','ITEM4');" .......... etc.>

// This function is called when the secondary date control gets focus
// The parameters required are the parent and child date control ids
    function SetEndDate(ctrl1,ctrl2) {
// Firstly assign the control objects using the parameters
      this.BegDate = document.getElementById(ctrl1);
      this.EndDate = document.getElementById(ctrl2);
// Next set a date variable using the content of the parent date control
      var b_year = this.BegDate.value.substring(6,8);
      if (b_year<50) {b_year = eval(b_year) + 2000} else {b_year = eval(b_year) + 1900};
      var b_mnth = this.BegDate.value.substring(3,5);
      if (b_mnth<10) {b_mnth='0'+b_mnth};
      var b_date = this.BegDate.value.substring(0,2);
      if (b_date<10) {b_date='0'+b_date};
      var today = new Date(b_year, b_mnth - 1, b_date);
//alert("Date : "+today);
// The following line will ensure that all dates are an offset from the parent date correctly
// even if it does not own a dateoffset attribute.
      var offset = eval(this.EndDate.getAttribute('dateoffset')) - eval(this.BegDate.getAttribute('dateoffset'));
      today.setDate(today.getDate()-offset);
      var t_date = today.getDate();
      if (t_date<10) {t_date='0'+t_date};
      var t_mnth = today.getMonth()+1;
      if (t_mnth<10) {t_mnth='0'+t_mnth};
      var t_year = today.getFullYear();
      if (t_year>=2000) {t_year = t_year - 2000} else {t_year = t_year - 1900};
      if (t_year<10) {t_year='0'+t_year};
      var end_date = t_date+"/"+t_mnth+"/"+t_year;
      this.EndDate.value = end_date;
    }


Note that all dates used within this script are DMY format. If you require a different format then rearrange the concatenation accordingly.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Expert
posted Hide Post
For those of us on 7.1.3, there is a known problem of receiving "year is undefined" when initially clicking on the calendar image to view the calendar. No workaround is given on the tech support site.

The workaround I use is to populate the control's value with a valid date via JavaScript.

Hope this helps some of you Smiler

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Member
posted Hide Post
Hi All,

I have some questions along these lines also.

I have date controls on an HTML form. When I run my fex the developer studio opens a new window about two thirds the size of a full window, when the date fields are displayed the clickable box to get the drop down for selections ends up in the middle of the field itself, also when you resize the window all the fields move but the clickable box does not. I am guessing the image is generated by some IBI javascript and it is placing the image statically on the page in specific locations, is there any way around this?

In addition when you click the image to get the pop-up calendar it always appears below and to the right of the image you are clicking, is there any way to change that too?

Any thoughts would be appreciated.

Thanks,

Rayden.


Web Focus version 7.1.4
Server Windows Server 2003
 
Posts: 26 | Registered: May 24, 2006Report This Post
Expert
posted Hide Post
Using point-and-click in HTML Composer, I added an onFOCUS event handler function for my Calendar Control, but the event does not trigger.


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     Calendar Control Events

Copyright © 1996-2020 Information Builders