当前位置: 首页>>代码示例>>PHP>>正文


PHP Form::addTbDateTimePicker方法代码示例

本文整理汇总了PHP中Nette\Forms\Form::addTbDateTimePicker方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::addTbDateTimePicker方法的具体用法?PHP Form::addTbDateTimePicker怎么用?PHP Form::addTbDateTimePicker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nette\Forms\Form的用法示例。


在下文中一共展示了Form::addTbDateTimePicker方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: function

 * @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\Controls;
use Nette\Forms\Form;
require '../vendor/autoload.php';
Debugger::$strictMode = TRUE;
Debugger::enable();
Form::extensionMethod('addTbDateTimePicker', function (Form $_this, $name, $label, $cols = NULL, $maxLength = NULL) {
    return $_this[$name] = new RadekDostal\NetteComponents\DateTimePicker\TbDateTimePicker($label, $cols, $maxLength);
});
$form = new Form();
$form->getElementPrototype()->class('form-horizontal');
$form->addTbDateTimePicker('date', 'Date and time:', NULL, 16)->setRequired()->setAttribute('class', 'form-control');
$form->addSubmit('submit', 'Send')->setAttribute('class', 'btn btn-default');
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 H:i')
  ));
}*/
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
开发者ID:cujan,项目名称:vcelyweb,代码行数:31,代码来源:TbDateTimePicker.php

示例2: 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) 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\TbDateTimePicker::register();
$form = new Form();
$form->getElementPrototype()->class('form-horizontal');
$form->addTbDateTimePicker('date', 'Date and time:')->setRequired()->setAttribute('class', 'form-control')->getLabelPrototype()->setAttribute('class', 'control-label col-sm-3');
$form->addSubmit('submit', 'Send')->setAttribute('class', 'btn btn-default');
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">
开发者ID:radekdostal,项目名称:nette-datetimepicker,代码行数:31,代码来源:TbDateTimePicker.php

示例3: Form

 * @package   RadekDostal\NetteComponents\DateTimePicker
 * @example   http://addons.nette.org/radekdostal/nette-datetimepicker
 * @author    Ing. Radek Dostál, Ph.D. <radek.dostal@gmail.com>
 * @copyright Copyright (c) 2014 - 2015 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\TbDateTimePicker::register();
$form = new Form();
$form->getElementPrototype()->class('form-horizontal');
$form->addTbDateTimePicker('date', 'Date and time:')->setRequired()->setAttribute('class', 'form-control datetimepicker');
$form->addSubmit('submit', 'Send')->setAttribute('class', 'btn btn-default');
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">
开发者ID:bombush,项目名称:NatsuCon,代码行数:31,代码来源:TbDateTimePicker.php


注:本文中的Nette\Forms\Form::addTbDateTimePicker方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。