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


PHP Form::addCheckbox方法代码示例

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


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

示例1: setupForm

 protected function setupForm(Form $form)
 {
     $form->addText('name', 'Name')->setRequired();
     $form->addTextArea('content', 'Content')->setAttribute('class', 'editor-standard');
     $form->addCheckbox('active', 'Active');
     $form->addSubmit('submit', 'Submit');
 }
开发者ID:04EO,项目名称:TrainingTaskNette,代码行数:7,代码来源:PageFormFactory.php

示例2: setupForm

 protected function setupForm(Form $form)
 {
     $form->addText('name', 'Name')->setRequired();
     $form->addTextArea('description', 'Description')->setAttribute('class', 'editor-standard');
     $form->addText('price', 'Price')->setType('number')->setRequired();
     $form->addUpload('image', 'Image')->addCondition(Form::FILLED)->addRule(Form::IMAGE);
     $form->addText('unit', 'Unit')->setRequired();
     $form->addText('vat', 'Vat Rate')->setType('number')->setRequired();
     $form->addCheckbox('active', 'Active');
     $form->addSubmit('submit', 'Submit');
     $this->onPreSave[] = $this->saveImage;
 }
开发者ID:04EO,项目名称:TrainingTaskNette,代码行数:12,代码来源:ProductFormFactory.php

示例3: array

$renderer->wrappers['control']['container'] = 'dd';
$renderer->wrappers['control']['.odd'] = 'odd';
$renderer->wrappers['control']['errors'] = TRUE;
$renderer->wrappers['label']['container'] = 'dt';
$renderer->wrappers['label']['suffix'] = ':';
$renderer->wrappers['control']['requiredsuffix'] = " •";
// group Personal data
$form->addGroup('Personal data');
$form->addText('name', 'Your name')->addRule(Form::FILLED, 'Enter your name');
$form->addText('age', 'Your age')->addRule(Form::FILLED, 'Enter your age')->addRule(Form::INTEGER, 'Age must be numeric value')->addRule(Form::RANGE, 'Age must be in range from %d to %d', array(10, 100));
$form->addSelect('gender', 'Your gender', $sex);
$form->addText('email', 'E-mail')->setEmptyValue('@')->addCondition(Form::FILLED)->addRule(Form::EMAIL, 'Incorrect E-mail Address');
// ... 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();
开发者ID:jakubkulhan,项目名称:nette,代码行数:31,代码来源:custom-rendering.php

示例4: 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

示例5: array

$sex = array(
	'm' => 'male',
	'f' => 'female',
);



// Step 1: Define form
$form = new Form;
$form->addText('name');
$form->addText('age');
$form->addRadioList('gender', NULL, $sex);
$form->addText('email')->setEmptyValue('@');

$form->addCheckbox('send');
$form->addText('street');
$form->addText('city');
$form->addSelect('country', NULL, $countries)->setPrompt('Select your country');

$form->addPassword('password');
$form->addPassword('password2');
$form->addUpload('avatar');
$form->addHidden('userid');
$form->addTextArea('note');

$form->addSubmit('submit');


// Step 1b: Define validation rules
$form['name']->setRequired('Enter your name');
开发者ID:norbe,项目名称:examples,代码行数:30,代码来源:manual-rendering.php

示例6: Form

use Tracy\Debugger;
use Tracy\Dumper;
use Nette\Utils\Html;
Debugger::enable();
$form = new Form();
// group Personal data
$form->addGroup('Personal data')->setOption('description', 'We value your privacy and we ensure that the information you give to us will not be shared to other entities.');
$form->addText('name', 'Your name:')->setRequired('Enter your name');
$form->addText('age', 'Your age:')->setRequired('Enter your age')->addRule($form::INTEGER, 'Age must be numeric value')->addRule($form::RANGE, 'Age must be in range from %d to %d', array(10, 100));
$form->addRadioList('gender', 'Your gender:', array('m' => 'male', 'f' => 'female'));
$form->addCheckboxList('colors', 'Favorite colors:', array('r' => 'red', 'g' => 'green', 'b' => 'blue'));
$form->addText('email', 'Email:')->setEmptyValue('@')->addCondition($form::FILLED)->addRule($form::EMAIL, 'Incorrect email address');
// ... then check email
// group Shipping address
$form->addGroup('Shipping address')->setOption('embedNext', TRUE);
$form->addCheckbox('send', 'Ship to address')->addCondition($form::FILLED)->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::FILLED)->setRequired('Enter your shipping address');
$countries = array('World' => array('bu' => 'Buranda', 'qu' => 'Qumran', 'st' => 'Saint Georges Island'), '?' => 'other');
$form->addSelect('country', 'Country:', $countries)->setPrompt('Select your country')->addConditionOn($form['send'], $form::FILLED)->setRequired('Select your country');
// group Your account
$form->addGroup('Your account');
$form->addPassword('password', 'Choose password:')->setRequired('Choose your password')->addRule($form::MIN_LENGTH, 'The password is too short: it must be at least %d characters', 3);
$form->addPassword('password2', 'Reenter password:')->setRequired('Reenter your password')->addRule($form::EQUAL, 'Passwords do not match', $form['password']);
$form->addUpload('avatar', 'Picture:')->addCondition($form::FILLED)->addRule($form::IMAGE, 'Uploaded file is not image');
$form->addHidden('userid');
$form->addTextArea('note', 'Comment:');
// group for buttons
开发者ID:jave007,项目名称:test,代码行数:31,代码来源:basic-example.php

示例7: array

$renderer = $form->getRenderer();
$renderer->wrappers['form']['container'] = Html::el('div')->id('form');
$renderer->wrappers['group']['container'] = NULL;
$renderer->wrappers['group']['label'] = 'h3';
$renderer->wrappers['pair']['container'] = NULL;
$renderer->wrappers['controls']['container'] = 'dl';
$renderer->wrappers['control']['container'] = 'dd';
$renderer->wrappers['control']['.odd'] = 'odd';
$renderer->wrappers['label']['container'] = 'dt';
$renderer->wrappers['label']['suffix'] = ':';
$renderer->wrappers['control']['requiredsuffix'] = " •";
$form->addGroup('Personal data');
$form->addText('name', 'Your name')->setRequired('Enter your name');
$form->addRadioList('gender', 'Your gender', array('m' => Html::el('option', 'male')->style('color: #248bd3'), 'f' => Html::el('option', 'female')->style('color: #e948d4')));
$form->addSelect('country', 'Country', array('Buranda', 'Qumran', 'Saint Georges Island'));
$form->addCheckbox('send', 'Ship to address');
$form->addGroup('Your account');
$form->addPassword('password', 'Choose password');
$form->addUpload('avatar', 'Picture');
$form->addTextArea('note', 'Comment');
$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 custom rendering example</title>
开发者ID:jave007,项目名称:test,代码行数:31,代码来源:custom-rendering.php

示例8: addFormControl

 public function addFormControl(\Nette\Forms\Form $form, Builder\Metadata $meta)
 {
     $input = $form->addCheckbox($meta->name, $meta->label);
     $this->addConditions($input, $meta->conditions);
     return $input;
 }
开发者ID:voda,项目名称:formbuilder,代码行数:6,代码来源:BooleanMapper.php

示例9: formPrint

 function formPrint(Form $form)
 {
     $form->addCheckbox($this->tag, $this->tag);
 }
开发者ID:beejhuff,项目名称:PHP-Security,代码行数:4,代码来源:Test.php


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