Actions

Jquery date picker

From zen2

Add the second line at the top:

require_once(PATH_tslib.'class.tslib_pibase.php');
require_once(t3lib_extMgm::extPath("jquery")."class.tx_jquery.php");


Add the last 2 lines here:

function main($content,$conf)	{
		$this->conf=$conf;
		$this->pi_setPiVarDefaults();
		$this->pi_loadLL();
		tx_jquery::setPlugins(array('iutil','datePicker','date'));
		tx_jquery::includeLib();


Use the date picker:

$content .= '<input class="dp-choose-date" id="date-pick-invDate" type="text" size=6  name="'.$this->prefixId.'[DATA][invDate]" value="'.$invDate.'">' . "\n";
$content .= '<script type="text/javascript">' . "\n"
. '// <![CDATA[' . "\n"
. "Date.format = 'yyyy-mm-dd';" . "\n"
. "$('#date-pick-invDate').datePicker({clickInput:true, startDate:'2004-01-01'});" . "\n"
. '// ]]>' . "\n"
. '</script>' . "\n";

With today's date selected:

$content .= '<input class="dp-choose-date" id="date-pick" type="text" size=6  name="'.$this->prefixId.'[DATA][invDate]" value="'.htmlspecialchars($this->piVars['input_field']).'">' . "\n";
$content .= '<script type="text/javascript">' . "\n"
.'// <![CDATA[' . "\n"
. "Date.format = 'yyyy-mm-dd';" . "\n"
. "$('#date-pick').datePicker({clickInput:true, startDate:'2004-01-01'}).val(new Date().asString());" . "\n"
. '// ]]>' . "\n"
. '</script>' . "\n";