*
 * @package   RadekDostal\NetteComponents\DateTimePicker
 * @example   https://componette.com/radekdostal/nette-datetimepicker/
 * @author    Ing. Radek Dostál, Ph.D. <*****@*****.**>
 * @copyright Copyright (c) 2014 - 2016 Radek Dostál
 * @license   GNU Lesser General Public License
 * @link      http://www.radekdostal.cz
 */
use Nette\Forms\Form;
use Tracy\Debugger;
require '../vendor/autoload.php';
Debugger::$strictMode = TRUE;
Debugger::enable();
RadekDostal\NetteComponents\DateTimePicker\DatePicker::register();
$form = new Form();
$form->addDatePicker('date', 'Date:', 10)->setRequired()->setAttribute('size', 10);
$form->addSubmit('submit', 'Send');
if ($form->isSuccess() === TRUE) {
    echo '<h2>Form was submitted and successfully validated</h2>';
    Debugger::dump($form->getValues());
    exit;
}
/*else
{
  $form->setDefaults(array(
    'date' => new \DateTime()
  ));
}*/
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
Esempio n. 2
0
 * @example   http://addons.nette.org/radekdostal/nette-datetimepicker
 * @author    Ing. Radek Dostál <*****@*****.**>
 * @copyright Copyright (c) 2014 Radek Dostál
 * @license   GNU Lesser General Public License
 * @link      http://www.radekdostal.cz
 */
use Nette\Diagnostics\Debugger;
use Nette\Forms\Form;
require '../vendor/autoload.php';
Debugger::$strictMode = TRUE;
Debugger::enable();
Form::extensionMethod('addDatePicker', function (Form $_this, $name, $label, $cols = NULL, $maxLength = NULL) {
    return $_this[$name] = new RadekDostal\NetteComponents\DateTimePicker\DatePicker($label, $cols, $maxLength);
});
$form = new Form();
$form->addDatePicker('date', 'Date:', 10, 10)->setRequired();
$form->addSubmit('submit', 'Send');
if ($form->isSuccess()) {
    echo '<h2>Form was submitted and successfully validated</h2>';
    Debugger::dump($form->getValues());
    exit;
}
/*else
{
  $form->setDefaults(array(
    'date' => date('Y-m-d')
  ));
}*/
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">