Monday, December 15, 2008

It is even more easy to replace the APEX with the jQuery calendar...

In a previous post I described how to replace the default APEX calendar with a better looking jQuery calendar. But one of the steps is that the "Display as" and "HTML Form Element Attributes" needed to be changed. But using jQuery more extensively that isn't even necessary. When you put the following code in an HTML Region on Page 0 (assuming you already included the jQuery stuff), all existing APEX calendar items are automagically 'converted' to jQuery calendar items. (No guarantee though: I didn't test it on all sorts of pages, may be dependent on your template). Look here for a live demo...

$(function(){
// Remove original Datepicker
$("td.datepicker + td" ).remove();
// Add jQuery Datepicker to all Datepicker input fields that are not hidden
$("td.datepicker > input[type!=hidden]" ).datepicker(
{ dateFormat : 'dd/mm/yy'
, closeText : 'X'
, clearText : ''
, showOn : 'button'
, buttonImage : '#WORKSPACE_IMAGES#calendar.gif'
, buttonImageOnly : true
});
});
Post a Comment