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     [SOLVED] JS script for fromdt and todt for Calendar

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] JS script for fromdt and todt for Calendar
 Login/Join
 
Gold member
posted
This is the script I have.
I want to show todt as today date
while showing fromdt as yesterday day as (today - 1).
but somehow when clicked on the calendar icon, it goes to 2012 september? Why did not it show the defaulted date?

function window_onload() {
var today = new Date();
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<10) {t_year='0'+t_year};
var end_date = t_mnth+"/"+t_date+"/"+t_year;
var beg_date = t_mnth+"/"+(t_date-1)+"/"+t_year;
document.getElementById('TODT').value = end_date;
document.getElementById('FROMDT').value = beg_date;
UpdateData();
}

Appreciate the help!

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


on VMS: OpenVMS AXP V8.2 Prod and TestEnvironment
Webfocus: WebFocus 7.6.1 Prod and TestEnvironment
 
Posts: 71 | Registered: May 23, 2004Report This Post
Gold member
posted Hide Post
Any takers at all? anyone?
Maybe I need to explain a bit more to make it clear.
I have from date and to date on my HTM launch page. From Date is to be shown '05/27/2009' while To date is to show today's date, which is '05/28/2009', in MDYY format. Somehow with that script, When I clicked on the calendar Icon, it goes to weird year, August month.
How do I fix that?


on VMS: OpenVMS AXP V8.2 Prod and TestEnvironment
Webfocus: WebFocus 7.6.1 Prod and TestEnvironment
 
Posts: 71 | Registered: May 23, 2004Report This Post
Virtuoso
posted Hide Post
A) you can set the basic attributes of the calendar when you set it up. Re-edit and set the initial properties.
B) you should not try to manipulate the displayed values of html objects prior to the UpdateData() function call. WF gives you a function called "onInitialUpdate()" that it will call (if it exists) after the screen data load is done. That is where you should do your JS work.

function window_onload() {
UpdateData();
}
function onInitialUpdate() {
var today = new Date();
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<10) {t_year='0'+t_year};
var end_date = t_mnth+"/"+t_date+"/"+t_year;
var beg_date = t_mnth+"/"+(t_date-1)+"/"+t_year;
document.getElementById('TODT').value = end_date; // are the id's really TODT and FROMDT? Did you change them?
document.getElementById('FROMDT').value = beg_date;
}


"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
Thank you so much for the reply, Dhagen.
I also found another problem in my code. I forgot to change the property of the calendar into MDYY and it then worked.
thanks for the tips on where to place this java script since i am a novice in Javascript.
Thanks again!


on VMS: OpenVMS AXP V8.2 Prod and TestEnvironment
Webfocus: WebFocus 7.6.1 Prod and TestEnvironment
 
Posts: 71 | Registered: May 23, 2004Report 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     [SOLVED] JS script for fromdt and todt for Calendar

Copyright © 1996-2020 Information Builders