本文整理汇总了PHP中Nette\Forms\Form::addDateTimePicker方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::addDateTimePicker方法的具体用法?PHP Form::addDateTimePicker怎么用?PHP Form::addDateTimePicker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Forms\Form
的用法示例。
在下文中一共展示了Form::addDateTimePicker方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Form
*
* @package RadekDostal\NetteComponents\DateTimePicker
* @example https://componette.com/radekdostal/nette-datetimepicker/
* @author Ing. Radek Dostál, Ph.D. <radek.dostal@gmail.com>
* @copyright Copyright (c) 2010 - 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\DateTimePicker::register();
$form = new Form();
$form->addDateTimePicker('datetime', 'Date and time:', 16)->setRequired()->setAttribute('size', 16);
$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(
'datetime' => new \DateTime()
));
}*/
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
示例2: function
* @example http://addons.nette.org/radekdostal/nette-datetimepicker
* @author Ing. Radek Dostál <radek.dostal@gmail.com>
* @copyright Copyright (c) 2010 - 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('addDateTimePicker', function (Form $_this, $name, $label, $cols = NULL, $maxLength = NULL) {
return $_this[$name] = new RadekDostal\NetteComponents\DateTimePicker\DateTimePicker($label, $cols, $maxLength);
});
$form = new Form();
$form->addDateTimePicker('datetime', 'Date and time:', 16, 16)->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(
'datetime' => date('Y-m-d H:i')
));
}*/
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">