Joomla: Using more than one JHTML::calendar in the backend?
Question
Trying to have more than one popup calendar in a component I'm building but only the first one works.
<?php echo JHTML::calendar($this->escape($item->datepassed), 'teacher_datepassed', 'teacher_datepassed', '%Y-%m-%d'); ?>
Some research though can't seem to find an example of more than one that worked:
http://docs.joomla.org/JHtml::calendar/1.6
http://www.zriel.com/joomla/25-how-to-add-pop-up-calendar-in-backend-of-joomla
Thoughts?
Thanks!
Solution
You have to use different names & ids for the calendars, otherwise javascript will crash. Also, make sure you dont have any other JS errors because it can cause things not to initialize properly. User Firebug Console or Chrome Console.
<?php
echo JHtml::calendar($item->datepassed, 'cal1_name', 'cal1_id');
echo JHtml::calendar($item->datepassed, 'cal2_name', 'cal2_id');
?>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow