Friday, September 12, 2008

Adding a Calender Control in Joomla Content

It is quite easy ... Thanks Sudheera for help in figuring this out!

Include the following CSS and JS from the root of Joomla installation.

<link rel="stylesheet" type="text/css" media="all" href="/includes/js/calendar/calendar-mos.css" title="green" />
<script type="text/javascript" src="/includes/js/calendar/calendar.js"></script>
<script type="text/javascript" src="/includes/js/jscalendar-1.0/lang/calendar-en.js"></script>

Now you can use a text box to hold the date value and show the calender control on the "onclick" event:

<input id="date1" name="date1" onclick="return showCalendar('date1','y-mm-dd');" value="2008-06-23">

The calender control will use the initial value if any and if the value of the text box is null then it will use the current date!

No comments: