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     Reset button clears Calendar Current/Start Date

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Reset button clears Calendar Current/Start Date
 Login/Join
 
Gold member
posted
We have the option Current/Start date in Calendar Properties checked off in our reports. When the report htm page is open, this defaults the date to todays date. The issue is when users click Reset button, it just clears the date, it doesnt reset with todays date. It would be nice if it did and maybe it is a bug, but I have tried to fix this by adding javascript to populate the calendar text with todays date on Reset. I want this to work on one click, but it makes me double click Reset button to populate todays date with the javascript. How do I get this to work with a single click? Here is the javascript Im using that works when double clicking:

//Begin function cmdReset_onclick
function cmdReset_onclick(ctrl) {
var d = new Date().toJSON().slice(0, 10).split('-');
document.getElementById("txtStartDate").value = d[1] +'/'+ d[2] +'/'+ d[0]; // mm/dd/yyyy
document.getElementById("txtEndDate").value = d[1] +'/'+ d[2] +'/'+ d[0]; // mm/dd/yyyy
}
//End function cmdReset_onclick


8007
Windows 7, PDF, Excel
 
Posts: 75 | Registered: September 03, 2013Report This Post
Expert
posted Hide Post
If this is a HTML Composer designed page, I *think* if you have a onInitialUpdate() function that sets the date, then the Reset should reset the page and run the onInitialUpdate() function. Try adding your cmdReset_onclick function to onInitialUpdate()...


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
May not be the best way, but it works
function cmdReset_onclick(ctrl) {
	var today = new Date();
	var dd = today.getDate();
	var mm = today.getMonth()+1; //January is 0!
	var yyyy = today.getFullYear();

	if(dd<10) {
	    dd='0'+dd
	} 

	if(mm<10) {
	    mm='0'+mm
	} 

	today = mm+'/'+dd+'/'+yyyy;

	txtStartDate.value = today;
	txtEndDate.value = today;
}


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Gold member
posted Hide Post
Moving code to onInitialUpdate seems to work when also having UpdateData in cmdReset_onclick, Thanks!

//Begin function onInitialUpdate
function onInitialUpdate(){
var d = new Date().toJSON().slice(0, 10).split('-');
document.getElementById("txtStartDate").value = d[1] +'/'+ d[2] +'/'+ d[0]; // mm/dd/yyyy
document.getElementById("txtEndDate").value = d[1] +'/'+ d[2] +'/'+ d[0]; // mm/dd/yyyy
}
//End function onInitialUpdate

//Begin function cmdReset_onclick
function cmdReset_onclick(ctrl) {
UpdateData();
}
//End function cmdReset_onclick


8007
Windows 7, PDF, Excel
 
Posts: 75 | Registered: September 03, 2013Report This Post
Gold member
posted Hide Post
Im new to JavaScript, can one of you tell me why (ctrl) is sometimes in the parenthesis and sometimes blank ()?

Examples:
onInitialUpdate()
UpdateData()
cmdReset_onclick(ctrl)
OnExecute(ctrl)


8007
Windows 7, PDF, Excel
 
Posts: 75 | Registered: September 03, 2013Report This Post
Virtuoso
posted Hide Post
It's an input parameter for the function.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Gold member
posted Hide Post
Why type (ctrl) vs ()?


8007
Windows 7, PDF, Excel
 
Posts: 75 | Registered: September 03, 2013Report This Post
Expert
posted Hide Post
When you add a function to a control by point-and-click in Dev Studio HTML Composer, it will add (ctrl) so that the JavaScript can reference the control - within the function you can then reference the control using ctrl - you don't need to reference the control via it's ID or name, but I tend to always use the control ID.

I think this is the explanation!


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
Example:
//Begin function combobox1_onchange
function combobox1_onchange(ctrl)
{
// Load the tasks based on the selected frequency
LoadTaskOptions(ctrl.value);


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
Here is my new issue with Reset button. The javascript i added works in resetting the calendar fields to todays date, but in a drill down it is not pulling in the dates from the first report htm page, it is setting the drill down htm to todays date too. I assume because the js is in the onInitialUpdate. Is there a way to get the Reset button to work just like pressing F5 on the keyboard works? in other words, is there javascript to mimic pressing F5?


8007
Windows 7, PDF, Excel
 
Posts: 75 | Registered: September 03, 2013Report This Post
Virtuoso
posted Hide Post
Here is what I'm normally do :
1- Add the reset button as the Composer create it
2- Add an onclick event to the Reset button
3- Create a function with:
//To Reset calendar
function resetCalendar(){
var d = new Date().toJSON().slice(0, 10).split('-');
document.getElementById("txtStartDate").value = d[1] +'/'+ d[2] +'/'+ d[0]; // mm/dd/yyyy 
document.getElementById("txtEndDate").value = d[1] +'/'+ d[2] +'/'+ d[0]; // mm/dd/yyyy 
}

4- call the above in the onInitialUpdate() and in cmdReset_onclick(ctrl) functions.

This way you will let the reset button do its "normal" job plus the calendar reset.

I just add in the reset what it does not do as I wish. I think it should work.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Gold member
posted Hide Post
This seems to work, and I dont even need an onInitialUpdate() script.

//Begin function cmdReset_onclick
function cmdReset_onclick(ctrl) {
window.location.reload();
}
//End function cmdReset_onclick

Seems too easy...


8007
Windows 7, PDF, Excel
 
Posts: 75 | Registered: September 03, 2013Report 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     Reset button clears Calendar Current/Start Date

Copyright © 1996-2020 Information Builders