本文整理汇总了PHP中Nette\Forms\Form::isSuccess方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::isSuccess方法的具体用法?PHP Form::isSuccess怎么用?PHP Form::isSuccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Forms\Form
的用法示例。
在下文中一共展示了Form::isSuccess方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public function process(\Nette\Forms\Form $form)
{
if ($form->isSuccess()) {
/** @var Thumbnailer */
$thumbator = $this->context->thumbator;
$thumb1 = new Thumb(100, 200, './');
$thumb2 = new Thumb(400, 500, './', Thumb::FILENAME_FORMAT_ORIGINAL);
$thumb3 = new Thumb(200, 100, './', Thumb::FILENAME_FORMAT_DIMENSION);
$thumb4 = new Thumb(40, 50, './', Thumb::FILENAME_FORMAT_ORIGINAL | Thumb::FILENAME_FORMAT_DIMENSION);
$thumb5 = new Thumb(300, 800, './', Thumb::FILENAME_FORMAT_VALUE);
$thumb5->setFilename('felix the caT!!');
$thumbator->addThumb($thumb1);
$thumbator->addThumb($thumb2);
$thumbator->addThumb($thumb3);
$thumbator->addThumb($thumb4);
$thumbator->addThumb($thumb5);
// Success handler
$thumbator->onSuccess[] = function ($t) {
Debugger::barDump('Sucess handler');
};
$thumbator->process($form->values->picture);
Debugger::barDump($form->values);
}
}
示例2: Form
* @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">
<head>
<meta charset="UTF-8">
示例3:
// group Second person
$form->addGroup('Second person');
$second = $form->addContainer('second');
$second->addText('name', 'Your name:');
$second->addText('email', 'Email:');
$second->addText('street', 'Street:');
$second->addText('city', 'City:');
// group for button
$form->addGroup();
$form->addSubmit('submit', 'Send');
if ($form->isSuccess()) {
echo '<h2>Form was submitted and successfully validated</h2>';
Dumper::dump($form->getValues());
exit;
}
?>
<!DOCTYPE html>
<meta charset="utf-8">
<title>Nette Forms containers example</title>
<link rel="stylesheet" media="screen" href="assets/style.css" />
<h1>Nette Forms containers example</h1>
<?php echo $form ?>
示例4: Form
<div class="page-header">
<h1>
<i class="fa fa-plus"></i> Add a new station log
</h1>
</div>
<?php
use Nette\Forms\Form;
use Kdyby\BootstrapFormRenderer\BootstrapRenderer;
$form = new Form();
$form->setRenderer(new BootstrapRenderer());
$form->addProtection();
$form->addText('reporter', 'Nickname')->setAttribute('placeholder', 'anonymous')->setRequired();
date_default_timezone_set("UTC");
$form->addText('datetime', 'When')->setAttribute('placeholder', '2014-01-01 14:00')->setDefaultValue(date('Y-m-d H:i:s'))->setRequired();
$form->addText('station', 'Station designator')->setRequired()->setAttribute('placeholder', 'E11');
$form->addText('qrh', 'Frequency')->setRequired()->setAttribute('placeholder', '4625')->addRule(Form::FLOAT);
$form->addText('callnumber', 'Call # (leave empty if not captured)')->setAttribute('placeholder', '472 639 5 or 441/30');
$form->addText('callid', 'Call ID (leave empty if not captured)')->setAttribute('placeholder', '472 639 5 or 441/30');
$form->addText('gc', 'Group Count')->setAttribute('placeholder', '10');
$form->addTextArea('body', 'Message (leave empty if not captured)')->setAttribute('placeholder', '39715 12345');
$form->addSubmit('send', 'Add to our mighty database');
if ($form->isSuccess() && $form->isValid()) {
//die();
$f = $form->getValues();
//dump($f);
$arr = array('time' => $f['datetime'], 'station' => $f['station'], 'qrh' => $f['qrh'], 'call_number' => $f['callnumber'], 'call_id' => $f['callid'], 'gc' => $f['gc'], 'body' => $f['body'], 'reporter' => $f['reporter']);
dibi::query('insert into logs_new', $arr);
echo "Log has been added. Thank you.";
}
$form->render();