I just upgraded to WebFocus 7.1 and I am using the dyanmic calendar control in the Resource Layout tool. The calendar is working just fine, however, I need to find a way to have the Calendar default to yesterday's date. This looks to be some kind of Javascript property that is used in the Value field for the Calendar. Has anyone been able to successfully set this value?
October 13, 2005, 08:02 AM
Tony A
Johnny,
Insert the following code between script tags in your HTML and then call it from within the OnLoad() function. It will populate every calendar control with yesterdays date.
function PrepDates() { var today = new Date( ); today.setDate(today.getDate() - 1); 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(); t_year = t_year - 2000 ; if (t_year<10) {t_year='0'+t_year}; var end_date = t_date+"/"+t_mnth+"/"+t_year;
for (i=0;i { if (document.all(i).elementtype == "editcalendar") { this.displayElement = document.getElementById (document.all(i).id); this.displayElement.value = end_date; } } }
Someone might be able to tidy the code for you but it does work in its current form.
TThis message has been edited. Last edited by: <Maryellen>,
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
October 14, 2005, 02:35 AM
dhagen
In version 7.1 I do this type of thing almost the same way I did it in 5.x. In layout tool, set the value of the calender control to !IBI.AMP.YSTDAY; (or whatever parm name you like). Create a .fex file that contains: