本文整理汇总了PHP中Nette\Forms\Form::render方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::render方法的具体用法?PHP Form::render怎么用?PHP Form::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Forms\Form
的用法示例。
在下文中一共展示了Form::render方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderFormBegin
/**
* @param Form $form
* @param array $args
*/
private static function renderFormBegin(Form $form, array $args)
{
if ($form->getRenderer() instanceof BootstrapRenderer) {
$form->render('begin', $args);
} else {
Nette\Bridges\FormsLatte\FormMacros::renderFormBegin($form, $args);
}
}
示例2: if
font-size: 120%;
}
th {
width: 10em;
text-align: right;
}
</style>
<link rel="stylesheet" type="text/css" media="screen" href="files/style.css" />
<script src="http://nette.github.com/resources/js/netteForms.js"></script>
</head>
<body>
<h1>Nette\Forms manual form rendering</h1>
<?php $form->render('begin') ?>
<?php if ($form->errors): ?>
<p>Opravte chyby:</p>
<?php $form->render('errors') ?>
<?php endif ?>
<fieldset>
<legend>Personal data</legend>
<table>
<tr class="required">
<th><?php echo $form['name']->getLabel('Your name:') ?></th>
<td><?php echo $form['name']->control->cols(35) ?></td>
</tr>
<tr class="required">
<th><?php echo $form['age']->getLabel('Your age:') ?></th>
示例3: foreach
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Nette Forms manual form rendering</title>
<link rel="stylesheet" media="screen" href="assets/style.css" />
<script src="https://nette.github.io/resources/js/netteForms.js"></script>
</head>
<body>
<h1>Nette Forms manual form rendering</h1>
<?php
$form->render('begin');
?>
<?php
if ($form->errors) {
?>
<ul class="error">
<?php
foreach ($form->errors as $error) {
?>
<li><?php
echo htmlspecialchars($error);
?>
</li>
<?php
}
示例4:
}
th {
width: 10em;
text-align: right;
}
</style>
<script src="netteForms.js"></script>
</head>
<body>
<h1>Nette\Forms manual form rendering</h1>
<?php
$form->render('begin');
?>
<?php
if ($form->getErrors()) {
?>
<p>Opravte chyby:</p>
<?php
$form->render('errors');
?>
<?php
}
?>
<fieldset>
<legend>Personal data</legend>
示例5: render
/**
* @param Nette\Forms\Form $form
* @return string
*/
function render(Nette\Forms\Form $form)
{
return $form->render();
}
示例6: 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();