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


PHP Form::addHidden方法代码示例

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


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

示例1:

// ... then check email
// group Shipping address
$form->addGroup('Shipping address')->setOption('embedNext', TRUE);
$form->addCheckbox('send', 'Ship to address')->addCondition(Form::EQUAL, TRUE)->toggle('sendBox');
// toggle div #sendBox
// subgroup
$form->addGroup()->setOption('container', Html::el('div')->id('sendBox'));
$form->addText('street', 'Street');
$form->addText('city', 'City')->addConditionOn($form['send'], Form::EQUAL, TRUE)->addRule(Form::FILLED, 'Enter your shipping address');
$form->addSelect('country', 'Country', $countries)->skipFirst()->addConditionOn($form['send'], Form::EQUAL, TRUE)->addRule(Form::FILLED, 'Select your country');
// group Your account
$form->addGroup('Your account');
$form->addPassword('password', 'Choose password')->addRule(Form::FILLED, 'Choose your password')->addRule(Form::MIN_LENGTH, 'The password is too short: it must be at least %d characters', 3)->setOption('description', '(at least 3 characters)');
$form->addPassword('password2', 'Reenter password')->addConditionOn($form['password'], Form::VALID)->addRule(Form::FILLED, 'Reenter your password')->addRule(Form::EQUAL, 'Passwords do not match', $form['password']);
$form->addFile('avatar', 'Picture');
$form->addHidden('userid');
$form->addTextArea('note', 'Comment');
// group for buttons
$form->addGroup();
$form->addSubmit('submit', 'Send');
// Step 2: Check if form was submitted?
if ($form->isSubmitted()) {
    // Step 2c: Check if form is valid
    if ($form->isValid()) {
        echo '<h2>Form was submitted and successfully validated</h2>';
        $values = $form->getValues();
        Debug::dump($values);
        // this is the end, my friend :-)
        if (empty($disableExit)) {
            exit;
        }
开发者ID:jakubkulhan,项目名称:nette,代码行数:31,代码来源:custom-rendering.php

示例2: subscribeAdmin

 /**
  * Add subscriber, from admin
  *
  * @param array $fields
  * @return Nette\Forms\Form
  */
 public static function subscribeAdmin($fields = array())
 {
     $form = new Form('addSubscriberAdmin');
     // Subscriber
     $form->addText('email', 'E-mail')->setRequired('E-mail address is requried.')->addRule(Form::EMAIL, 'Must be valid e-mail address');
     $form->addCheckbox('active', 'Active')->setDefaultValue(1);
     if (array_key_exists('firstName', $fields)) {
         $form->addText('firstName', 'First Name');
     }
     if (array_key_exists('lastName', $fields)) {
         $form->addText('lastName', 'Last Name');
     }
     if (array_key_exists('age', $fields)) {
         $form->addText('age', 'Age')->addCondition(Form::FILLED)->addRule(Form::INTEGER, 'Age must be a numeric number.')->addRule(Form::RANGE, 'Age should be between 8 and 120 years :).', array(5, 120));
     }
     if (array_key_exists('interests', $fields)) {
         $form->addTextarea('interests', 'Interests');
     }
     if (array_key_exists('location', $fields)) {
         $form->addText('location', 'Location');
     }
     $form->addHidden('date', date('Y-m-d H:i:s'));
     $form->addText('ip', 'Ip')->setDefaultValue(Utils::getRealIp())->addCondition(Form::FILLED)->addRule(Form::PATTERN, 'Must be valid IP', '((^|\\.)((25[0-5])|(2[0-4]\\d)|(1\\d\\d)|([1-9]?\\d))){4}$');
     // Submit
     $form->addSubmit('submit', 'Add')->setAttribute('class', 'button-primary');
     return $form;
 }
开发者ID:hkarriche,项目名称:wordpress,代码行数:33,代码来源:Forms.php

示例3: date

		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width">
		<link rel="stylesheet" href="css/bootstrap.css">
		<link rel="stylesheet" href="css/b7.css">
		<script src="js/jquery.js"></script>
		<script src="js/netteForms.js"></script>
		<script src="js/main.js"></script>
	</head>
	<body>
		
		<div style="width: 800px;">
			
		<?php 
echo "<h2>" . date('d.m.Y H:i:s') . "</h2>";
$form = new Form();
$form->addHidden('general', '[GENERAL]');
$form->addHidden('file');
$form->addGroup('B7 setting');
$form->addHidden('b7', '[B7]');
$form->addText('stanoviste', 'Číslo stanoviště:')->setOption('description', 'Zadejte číslo stanoviště od 1 do 999')->setRequired('Zadejte číslo od 1 do 999')->addRule(Form::INTEGER, 'Stanoviště musí být číslo')->addRule(Form::RANGE, 'Číslo musí být od 1 do 99', array(1, 999))->setType('number');
$form->addHidden('cards');
$form->addHidden('ftp', '[FTP]');
$form->addHidden('server');
$form->addHidden('user');
$form->addHidden('password');
$form->addHidden('dstdir');
$form->addHidden('db', '[DB]');
$form->addHidden('script');
$form->addHidden('dbserver');
$form->addHidden('dbport');
$form->addHidden('dbuser');
开发者ID:nakoukal,项目名称:raspi_www,代码行数:31,代码来源:index.php

示例4: Form

<?php

/**
 * Nette\Forms Cross-Site Request Forgery (CSRF) protection example.
 */
require_once __DIR__ . '/../../Nette/loader.php';
use Nette\Forms\Form, Nette\Debug;
Debug::enable();
$form = new Form();
$form->addProtection('Security token did not match. Possible CSRF attack.', 3);
$form->addHidden('id')->setDefaultValue(123);
$form->addSubmit('submit', 'Delete item');
// Step 2: Check if form was submitted?
if ($form->isSubmitted()) {
    // Step 2c: Check if form is valid
    if ($form->isValid()) {
        echo '<h2>Form was submitted and successfully validated</h2>';
        $values = $form->getValues();
        Debug::dump($values);
        // this is the end, my friend :-)
        if (empty($disableExit)) {
            exit;
        }
    }
}
// Step 3: Render form
?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8">
开发者ID:jakubkulhan,项目名称:nette,代码行数:31,代码来源:CSRF-protection.php

示例5: date

		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width">
		<link rel="stylesheet" href="css/bootstrap.css">
		<link rel="stylesheet" href="css/b7.css">
		<script src="js/jquery.js"></script>
		<script src="js/netteForms.js"></script>
		<script src="js/main.js"></script>
	</head>
	<body>
		
		<div style="width: 900px;">
		<?php 
echo "<h2>" . date('d.m.Y H:i:s') . "</h2>";
$form = new Form();
$form->addGroup('GENERAL setting');
$form->addHidden('general', '[GENERAL]');
$form->addText('file', 'soubor:')->setOption('description', Html::el('b')->setHtml('/home/pi/b7/vysledky.log Cesta pro umisteni souboru !!'))->setRequired('Zadejte název souboru');
$form->addGroup('B7 setting');
$form->addHidden('b7', '[B7]');
$form->addText('stanoviste', 'Číslo stanoviště:')->setOption('description', 'Zadejte číslo stanoviště od 1 do 999')->setRequired('Zadejte číslo od 1 do 999')->addRule(Form::INTEGER, 'Stanoviště musí být číslo')->addRule(Form::RANGE, 'Číslo musí být od 1 do 99', array(1, 999))->setType('number');
$form->addTextArea('cards', 'Service cards:')->setOption('description', 'Zadejte čísla karet v hexadecimalnim formatu oddělené "|"')->setRequired('Zadejte číslo karty ve formátu hexa|hexa')->addRule(Form::PATTERN, 'cards neplatný formát hexa|hexa', '^(([a-fA-F0-9]){8})(\\|(([a-fA-F0-9]){8}))*$');
$form->addGroup('FTP setting');
$form->addHidden('ftp', '[FTP]');
$form->addText('ftpserver', 'server:')->setOption('description', 'Zadejte adresu ftp serveru')->setRequired('Zadejte adresu ftp serveru');
$form->addText('ftpuser', 'user:')->setOption('description', 'Zadejte uživatelské jméno')->setRequired('Zadejte uživatelské jméno');
$form->addText('ftppassword', 'heslo:')->setOption('description', 'Zadejte heslo')->setRequired('Zadejte heslo');
$form->addText('ftpdstdir', 'Cílový adresář:')->setOption('description', 'Zadejte název cílového adresáře kde bude uložen soubor s logy /log')->setRequired('Zadejte název cílového adresáře');
$form->addGroup('MYSQL setting');
$form->addHidden('db', '[DB]');
$form->addText('script', 'Ceata ke skriptu: ')->setOption('description', Html::el('b')->setHtml('/home/pi/b7/b7_mysql.sh Nevyplněno znamená neodesílat data přímo do databáze !!'));
$form->addText('dbserver', 'server:')->setOption('description', 'Zadejte adresu mysql serveru');
开发者ID:nakoukal,项目名称:raspi_www,代码行数:31,代码来源:admin.php

示例6: Form

use Nette\Forms\Form;
?>
<html>
	<head>
		 <title>B7 time setting</title>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width">
		<link rel="stylesheet" href="css/bootstrap.css">
		<link rel="stylesheet" href="css/b7.css">
		<script src="js/jquery.js"></script>
		<script src="js/netteForms.js"></script>
		<script src="js/main.js"></script>
	</head>
	<body>
		<?php 
$form = new Form();
$form->addGroup('GENERAL setting');
$form->addHidden('general', '[GENERAL]');
$form->addText('datetime', 'Datum a čas:')->setOption('description', 'Zadejte název souboru')->setRequired('Zadejte název souboru');
$form->addSubmit('send', 'Uložit');
$form->setDefaults($ini_array);
echo $form;
// vykreslí formulář
if ($form->isSuccess()) {
    $values = $form->getValues(true);
    echo "\t<script>\r\n\t\t\t\t\t\t\talert('Formulář byl uložen');\r\n\t\t\t\t\t\t\twindow.location.replace('time.php');\r\n\t\t\t\t\t\t</script>)";
}
?>
		
	</body>
</html>
开发者ID:nakoukal,项目名称:raspi_www,代码行数:31,代码来源:time.php


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