Get: HTML_QuickForm_jscalendar & jsCalendar
View: More documentation
<?php
/**
* Example of usage of HTML_QuickForm_jscalendar element
*
* @author Philippe Jausions <jausions@php.net>
* @link http://pear.11abacus.com/package/HTML_QuickForm_jscalendar
* @link http://www.dynarch.com/projects/calendar/
*/
/**
* Required packages
* (Make sure your include_path is set properly to point to the PEAR
* installation on your computer / server)
*/
require_once 'HTML/QuickForm.php';
require_once 'HTML/QuickForm/jscalendar.php';
/**
* Main
*/
// Where the jsCalendar script is located
$GLOBALS['_HTML_QUICKFORM_JSCALENDAR_BASEPATH'] = '/JScript/calendar/';
$form = new HTML_QuickForm('myForm');
// PHP 4 users, make sure to use the =& assignment by reference operator
$cal =& $form->addElement('jscalendar', 'date', 'Date');
// Default values are set as usual
$form->setDefaults(array('date' => '1987-06-05'));
// Multiple values option
$cal2 =& $form->addElement('jscalendar', 'date2', 'Dates');
$cal2->setMultiple();
$form->setDefaults(array('date2' => array('1987-06-05', '1987-08-09')));
// With button trigger instead of popping-up on field onFocus event
$cal3 =& $form->addElement('jscalendar', 'date3', 'Date', array('button'));
$form->setDefaults(array('date3' => '1989-08-07'));
// With display area
$cal4 =& $form->addElement('jscalendar', 'date4', 'Date', $options);
$form->setDefaults(array('date4' => '1991-09-01'));
$cal4->setConfig('daFormat', '%m/%d/%Y');
$cal4->setConfig('button');
$form->addElement('submit', 'submit', 'Submit');
if ($form->validate()) {
$form->freeze();
}
?>
<html>
<head>
<title>PEAR's HTML_QuickForm with DynArch's jsCalendar example</title>
<link rel="stylesheet" type="text/css" href="/JScript/calendar/calendar-win2k-1.css" />
</head>
<body>
<h1>PEAR's HTML_QuickForm with DynArch's jsCalendar example</h1>
<p>Get: <a href="http://pear.11abacus.com/package/HTML_QuickForm_jscalendar">HTML_QuickForm_jscalendar</a> & <a href="http://www.dynarch.com/projects/calendar/">jsCalendar</a></p>
<p>View: <a href="http://pear.11abacus.com/dev/HTML/QuickForm/jscalendar.phps">More documentation</a></p>
<?php
$form->display();
highlight_file(__FILE__);
?>
</body>
</html>