showCalendar is not defined

Have a programming question regarding your component, plug-in, extension or core hacks? Have an interesting tidbit, FAQ or programming tip you’d like to share? This is the place for you.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Post Reply
User avatar
uweD
Joomla! Apprentice
Joomla! Apprentice
Posts: 39
Joined: Mon May 14, 2007 9:38 pm
Location: Auckland -- New Zealand
Contact:

showCalendar is not defined

Post by uweD » Fri Sep 14, 2007 3:05 am

Hi,

I try to use the Java Script  showCalender() function on the front end. This works fine on the back end

Code: Select all

<?php
JHTML::_('behavior.calendar');
?>
<input type="text" class="inputDate" id="dateFieldXYZ" /><input type="reset"  value="..." onclick="return showCalendar('dateFieldXYZ','d-mm-yy')" />
            


But: If I use the same lines on the front end I just get an error message that 'showCalender' is not defined.

Anyone an idea how to use that functionality on the front end?

Thanks,
Uwe
Last edited by uweD on Sun Sep 16, 2007 8:51 pm, edited 1 time in total.
________________________
Uwe Duesing
http://www.uweduesing.com
Skype:uweOnehunga

mtlnews

Re: showCalendar is not defined

Post by mtlnews » Sat Sep 15, 2007 1:01 pm

hey Uwe

im just learning php and joomla right now, and I came across the same problem. What I did was I added this code to the top of the view.html.php file where I want the calendar to show up:

// includes for mini-calendar
$lang =& JFactory::getLanguage();
JHTML::script( 'calendar_mini', 'includes/js/calendar/' );
JHTML::script( 'calendar-'. $lang->getTag(), 'includes/js/calendar/lang/' );

I wrote " 'calendar-'. $lang->getTag() " instead of just " calendar-en-GB " because eventually, I might add the french language..

User avatar
uweD
Joomla! Apprentice
Joomla! Apprentice
Posts: 39
Joined: Mon May 14, 2007 9:38 pm
Location: Auckland -- New Zealand
Contact:

Re: showCalendar is not defined

Post by uweD » Sun Sep 16, 2007 6:06 am

Hi mtlnews,

Thanks for that! I will try it at work tomorrow. Thanks a lot for your help,

Uwe
________________________
Uwe Duesing
http://www.uweduesing.com
Skype:uweOnehunga

User avatar
uweD
Joomla! Apprentice
Joomla! Apprentice
Posts: 39
Joined: Mon May 14, 2007 9:38 pm
Location: Auckland -- New Zealand
Contact:

Re: showCalendar is not defined

Post by uweD » Sun Sep 16, 2007 8:50 pm

Hi mtlNews,

Your solution did not work for me as I ran into the same problem. But I compared the JS includes in the admin area and the front page where I tried to use the calender. One libraries is missing on the front end - don't ask me why...

Anyway: I added the following lines and everything seems to work fine now:

Code: Select all

   $document = &JFactory::getDocument();
   $document->addScript("includes/js/joomla.javascript.js");


Thanks for your replies,

Uwe
Last edited by uweD on Mon Sep 17, 2007 1:59 am, edited 1 time in total.
________________________
Uwe Duesing
http://www.uweduesing.com
Skype:uweOnehunga


Post Reply