Pop-up calendar in Joomla
The Joomla frameworks offers an easy solution to insert a date field with a pop-up calender select box, to easily select a date. The pop-up is Mootools operated.
<?php
echo JHTML::_('calendar', $value, "mydatename", "mydateid", '%Y-%m-%d');
?>
Where $value contains the date value of the input field, mydatename is the name of the input field, and mydateid is the ID of the input field.
Easy!
There are many other tutorials online which over-complicate this simple Joomla function, and instruct the developer to manually insert the code for the HTML input field and Javascript. This is unnecessary.
Additionally, using this function means that correct functionality through Joomla upgrades (for example, Joomla 1.5 to Joomla 1.7). Manually inserting the code for the input field, and the Javascript will result in errors after upgrading.
Comments (0)