The current application I'm working on needs to run
under both IE and Netscape. The bulk of the users are
using IE 5, IE 6 and NS 4.7x, but some are using NS 6
and 7. The JS calendar does not work with NS 6 and 7
because of permission errors. I've reworked the
calendar so that it works under several Mozilla builds,
NS 6, NS 7, NS4.7x and IE 5+. The following code
needs to be chaned within the DbDateFieldTag (v1.1.3
and 1.1.4dev):
[...]
jsCalendarDateFormat =
jsCalendarDateFormat.replace('d', 'D');
}
}
// modified to use calendar2.html instead
if (jsCalendarDateFormat != null) // JS
Date Format set ?
{
tagBuf.append("document.xDtFmtXx='"
+ jsCalendarDateFormat + "'; ");
}
tagBuf.append("document.xDtFldXx=document.dbform['")
.append(getFormFieldName())
.append("']; ")
.append("newWin = window.open('")
.append(request.getContextPath())
.append("/dbformslib/jscal/calendar2.html','cal','width=250,height=260')\">")
.append("<IMG SRC=\&quot;")
.append(request.getContextPath())
.append("/dbformslib/jscal/calendar.gif\&quot; WIDTH=\&quot;20\&quot;
HEIGHT=\&quot;20\&quot; ")
.append("BORDER=\&quot;0\&quot; alt=\&quot;Click
on the Calendar to activate the Pop-Up Calendar
Window.\&quot;>")
.append("</a>");
}
[...]
In addition, the attached file (calendar2.html) needs
to be placed in the 'dbformslib\jscal' folder with the
rest of the calendar javascript.
Note, I'm not really a JS programmer, so there may be
other (better) ways to accomplish this.
Mike
calendar2.html (reworked JS calendar)
Logged In: YES
user_id=496000
Forgot that one other place needs to be changed within the
DbDateFieldTag (slightly above where the previous changes
were made):
[...]
// written by Robert W. Husted to edit the field:
if (!("true".equals(this.getHidden())) &&
("true".equals(this.getUseJsCalendar())))
{
// modified to use calendar2.html instead
tagBuf.append(" <A HREF=\&quot;javascript:{};\&quot;
").append(" onclick=\&quot;");
// if date format is not explicitely set for
this calendar,
[...]
Without this (when JS debug is turned on), you get an
invalid object reference message (IE 5 in particular) when
clicking on the calendar button.