31August

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.

Posted in Tutorials, Joomla

Comments (0)

Leave a comment

You are commenting as guest.

Cancel Submitting comment...

About Dave Horsfall

Dave Horsfall is a British software developer and founder of the hwdMediaShare project. More...

Recent Comments

  • Ppl like you get all the brains. I just get to say thanks for he awnesr.

    Rosa, 06. September, 2011 |

  • Ppl like you get all the brains. I just get to say thanks for he awnesr.

    Rosa, 06. September, 2011 |

  • No, the file should be called "project.properties", and it should be located in the same directory as the file called "project.xml". I'm...

    Dave Horsfall, 29. August, 2011 |

  • There is no file called "project.properties". There is a file "project.xml" is this the one? It is not "simple text" though...

    OppfinnarJocke, 29. August, 2011 |