1 Replies - 752 Views - Last Post: 10 October 2012 - 06:27 AM

#1 germanizer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 09-October 12

Joomla and jQuery Datepicker inside custom html module

Posted 10 October 2012 - 06:26 AM

Hi folks,

I'm a sysadmin/webmaster with way too little php coding skills and due to a new job I started I need to do some serious learning in the area of creating custom html modules within the Joomla CMS.

Currently I'm tasked with modifying an entry form to include a popup style calendar, and from what I can tell there's are a bunch of handy jquery scripts available, but I'm stuck trying to figure out where to put the function part of the necessary code.

I've used the following code to load the necessary .js and .css files, but I can't seem to figure out how/where to place the function in order for the input field to result in the calendar popping up.

For starters, here's my code to ensure the files to get loaded within the header tags.

$doc =& JFactory::getDocument();
$doc->addScript( JURI::root( true ).'scripts/js/jquery.datePicker-min.js' );
$doc->addScript( JURI::root( true ).'scripts/js/jquery-1.6.1.min.js' );
$doc->addStyleSheet( JURI::root( true ).'scripts/css/datePicker.css' );



Next, from what I understand I need to have a "addScriptDeclaration" line to add the function part - the part that results in the calendar popping up when someone clicks on the necessary input field.

$doc->addScriptDeclaration('
    $(window).ready(function(){
  $('#date-pick').datePicker({clickInput:true});
});
');



and that's pretty much where I'm stuck at this point.

I have the following code for the input field:

		 <input name="EventDate" id="datepicker"  size="10" maxlength="25" class="date-pick" type="text" value="<?php if (isset($_POST['EventDate'])) echo $_POST['EventDate']; ?>">



The php POST was already existing in the code, I'm not sure whether it conflicts with what I'm trying to do, but fact is all I can 'achieve' right now is an empty page, or an internal server error 500.

I know this is probably a ridiculously easy task for most people here, but as I said in the beginning my javascript/php coding skills are embarrassing, so even this small task has taken up a lot of my time so far and I'm hoping someone can point me in the right direction of getting this working as it's supposed to.

Is This A Good Question/Topic? 0
  • +

Replies To: Joomla and jQuery Datepicker inside custom html module

#2 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10806
  • View blog
  • Posts: 40,279
  • Joined: 27-December 08

Re: Joomla and jQuery Datepicker inside custom html module

Posted 10 October 2012 - 06:27 AM

Please avoid duplicate posting.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1