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


PHP HTML_QuickForm2::addHidden方法代码示例

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


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

示例1: testGroupHiddens

 public function testGroupHiddens()
 {
     $form = new HTML_QuickForm2('testGroupHiddens', 'post', null, false);
     $hidden = $form->addHidden('aHiddenElement');
     $renderer = HTML_QuickForm2_Renderer::factory('stub');
     $renderer->setOption('group_hiddens', false);
     $form->render($renderer);
     $this->assertEquals(array(), $renderer->getHidden());
     $renderer->setOption('group_hiddens', true);
     $form->render($renderer);
     $this->assertEquals(array($hidden->__toString()), $renderer->getHidden());
 }
开发者ID:andreaswarnaar,项目名称:HTML_QuickForm2.1,代码行数:12,代码来源:StubTest.php

示例2: array

      .quickform div.errors ul { margin:0; }
      .quickform div.error input { border-color: #C00; background-color: #FEF; }
      .quickform div.qf-checkable label,
      .quickform div.qf-checkable input { display: inline; float: none; }
      .quickform div.qf-checkable div,
      .quickform div.qf-message { margin-left: 170px; }
      .quickform div.qf-message { font-size: 88%; color: #C00; }
    </style>
    <title>HTML_QuickForm2 default renderer example</title>
  </head>
  <body>
<?php 
require_once 'HTML/QuickForm2.php';
require_once 'HTML/QuickForm2/Renderer.php';
$form = new HTML_QuickForm2('example');
$fs = $form->addFieldset()->setLabel('Your information');
$username = $fs->addText('username')->setLabel('Username');
$username->addRule('required', 'Username is required');
$password = $fs->addPassword('pass')->setLabel(array('Password', 'Password should be 8 characters at minimum'));
$password->addRule('required', 'Password is required');
$form->addHidden('my_hidden1')->setValue('1');
$form->addHidden('my_hidden2')->setValue('2');
$form->addSubmit('submit', array('value' => 'Send', 'id' => 'submit'));
if ($form->validate()) {
    $form->toggleFrozen(true);
}
$renderer = HTML_QuickForm2_Renderer::factory('default')->setOption(array('group_hiddens' => true, 'group_errors' => true, 'required_note' => '<strong>Note:</strong> Required fields are marked with an asterisk (<em>*</em>).'))->setTemplateForId('submit', '<div class="element">{element} or <a href="/">Cancel</a></div>')->setTemplateForClass('HTML_QuickForm2_Element_Input', '<div class="element<qf:error> error</qf:error>"><qf:error>{error}</qf:error>' . '<label for="{id}" class="qf-label<qf:required> required</qf:required>">{label}</label>' . '{element}' . '<qf:label_2><div class="qf-label-1">{label_2}</div></qf:label_2></div>');
echo $form->render($renderer);
?>
</body>
</html>
开发者ID:andreaswarnaar,项目名称:HTML_QuickForm2.1,代码行数:31,代码来源:default-renderer.php

示例3: testRenderGroupedHiddens

 public function testRenderGroupedHiddens()
 {
     $form = new HTML_QuickForm2('groupedHiddens');
     $hidden1 = $form->addHidden('hidden1');
     $hidden2 = $form->addHidden('hidden2');
     $renderer = HTML_Quickform2_Renderer::factory('callback')->setOption('group_hiddens', false);
     $html = $form->render($renderer)->__toString();
     $this->assertContains('<div style="display: none;">' . $hidden1->__toString() . '</div>', $html);
     $this->assertContains('<div style="display: none;">' . $hidden2->__toString() . '</div>', $html);
     $renderer->setOption('group_hiddens', true);
     $html = $form->render($renderer)->__toString();
     // why not ?
     // $this->assertNotContains('<div style="display: none;">', $html);
     $this->assertContains($hidden1->__toString() . $hidden2->__toString(), $html);
 }
开发者ID:andreaswarnaar,项目名称:HTML_QuickForm2.1,代码行数:15,代码来源:CallbackTest.php


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