Menu

#18 Fix for JS calendar to work under Mozilla/NS 6/7

open
nobody
None
5
2003-06-03
2003-06-03
No

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=\"")
.append(request.getContextPath())

.append("/dbformslib/jscal/calendar.gif\" WIDTH=\"20\"
HEIGHT=\"20\" ")
.append("BORDER=\"0\" alt=\"Click
on the Calendar to activate the Pop-Up Calendar
Window.\">")
.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

Discussion

  • Michael Slack

    Michael Slack - 2003-06-03

    calendar2.html (reworked JS calendar)

     
  • Michael Slack

    Michael Slack - 2003-07-17

    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=\"javascript:{};\"
    ").append(" onclick=\"");

    // 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.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.