joomla is here http://www.dynarch.com/demos/jscalendar ... rence.html
To use it on your form fields:-
- Code: Select all
<?php JHTML::_('behavior.calendar'); ?>
<input type="text" name="DateOfBirth" id="DateOfBirth" value="" />
<img class="calendar" src="templates/system/images/calendar.png" alt="calendar" onclick="return showCalendar('DateOfBirth', '%d-%m-%Y');" />
- the JHTML call makes sure the necassary javascript is in the head of the page
- input holds the returned date (and will set the inital date from the value attribute)
- The image onclick calls showCalendar with the id of the input and the date format *note the %*
The alternative way to call it, which seems to be the only way i could set the properties listed here http://www.dynarch.com/demos/jscalendar ... de_sec_2.3
is:-
- Code: Select all
<?php JHTML::_('behavior.calendar'); ?>
<input type="text" name="DateOfBirth" id="DateOfBirth" value="" />
<img class="calendar" src="templates/system/images/calendar.png" alt="calendar" id="showCalendar" />
<script type="text/javascript">
var startDate = new Date(1980,01,01)
Calendar.setup(
{
inputField : "DateOfBirth", // ID of the input field
ifFormat : "%d-%m-%Y", // the date format
button : "showCalendar", // ID of the button
date : startDate
}
);
</script>
note:
There is a bug in the calendar that prevents the date property (inital date shown) from working. You can either pre-fill the value attribute of the input element or change if (dateEl) to: if (dateEl && dateEl.value) in media/system/js/calendar-setup.js (also make sure you pass a javascript date object)
hope this helps someone.
