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


PHP HTML_QuickForm2::addText方法代码示例

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


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

示例1: testGroupErrors

 public function testGroupErrors()
 {
     $form = new HTML_QuickForm2('testGroupErrors');
     $text = $form->addText('anElement', array('id' => 'anElement'))->setError('an error');
     $renderer = HTML_QuickForm2_Renderer::factory('stub');
     $renderer->setOption('group_errors', false);
     $form->render($renderer);
     $this->assertEquals(array(), $renderer->getErrors());
     $renderer->setOption('group_errors', true);
     $form->render($renderer);
     $this->assertEquals(array('anElement' => 'an error'), $renderer->getErrors());
 }
开发者ID:andreaswarnaar,项目名称:HTML_QuickForm2.1,代码行数:12,代码来源:StubTest.php

示例2: testRenderWithStyle

 public function testRenderWithStyle()
 {
     $form = new HTML_QuickForm2('arrayStyle');
     $text1 = $form->addText('foo', array('id' => 'testArrayWithStyle'));
     $text2 = $form->addText('bar', array('id' => 'testArrayWithoutStyle'));
     $renderer = HTML_Quickform2_Renderer::factory('array')->setStyleForId('testArrayWithStyle', 'weird');
     $array = $form->render($renderer)->toArray();
     $this->assertEquals('weird', $array['elements'][0]['style']);
     $this->assertArrayNotHasKey('style', $array['elements'][1]);
 }
开发者ID:andreaswarnaar,项目名称:HTML_QuickForm2.1,代码行数:10,代码来源:ArrayTest.php

示例3: testRenderGroupedErrors

 public function testRenderGroupedErrors()
 {
     $form = new HTML_QuickForm2('groupedErrors');
     $element = $form->addText('testGroupedErrors')->setError('Some error');
     $renderer = HTML_Quickform2_Renderer::factory('callback')->setOption(array('group_errors' => true, 'errors_prefix' => 'Your errors:', 'errors_suffix' => ''));
     $this->assertContains('<div class="errors"><p>Your errors:</p><ul><li>Some error</li></ul></div>', $form->render($renderer)->__toString());
 }
开发者ID:andreaswarnaar,项目名称:HTML_QuickForm2.1,代码行数:7,代码来源:CallbackTest.php

示例4: array

}
require_once 'lib/pear/HTML/QuickForm2.php';
$form = new HTML_QuickForm2('form', 'post', array('role' => 'form'));
// fields
// elements
$form->addElement('hidden', 'action')->setValue($this_action);
$form->addElement('select', 'new_urna', array('autofocus' => 'autofocus'))->setLabel('Urna:')->loadOptions($urna_select)->addRule('required', 'Valor requerido');
$votos_attr_centro = array('class' => 'form-inline col-xs-3', 'maxlength' => 3, 'pattern' => '\\d*', 'title' => 'Debe introducir solo numeros', 'placeholder' => 'Votos Centro');
$votos_attr_claustro = array('class' => 'form-inline col-xs-3', 'maxlength' => 3, 'pattern' => '\\d*', 'title' => 'Debe introducir solo numeros', 'placeholder' => 'Votos Claustro');
foreach ($lista_select as $lista_id => $lista_nombre) {
    unset($votos);
    $form->addElement('static', null)->setContent('<label for="votos" class="col-xs-6 text-right control-label">' . $lista_nombre . ':</label>');
    //$form->addElement('static', null)
    //       ->setContent('<div class="col-xs-8 titus">')
    //;
    $form->addText("new_lista[{$lista_id}][votos_centro]", $votos_attr_centro);
    $form->addText("new_lista[{$lista_id}][votos_claustro]", $votos_attr_claustro);
    //$form->addElement('static', null)
    //       ->setContent('</div>')
    //;
}
$form->addElement('button', 'btnSubmit', array('type' => 'submit', 'value' => 'Guardar', 'class' => 'btn btn-lg btn-primary'))->setContent('Guardar');
require_once 'HTML/QuickForm2/Renderer.php';
require_once 'HTML/QuickForm2/JavascriptBuilder.php';
$renderer = HTML_QuickForm2_Renderer::factory('default');
//$renderer->setJavascriptBuilder(new HTML_QuickForm2_JavascriptBuilder(null, __DIR__ . '/../lib/pear/data/HTML_QuickForm2/js'));
$renderer->setOption(array('errors_prefix' => 'El formulario contiene errores:', 'required_note' => '<div><span class="required">*</span> denota campos requeridos</div>'));
if (isset($_REQUEST['btnSubmit']) and $_REQUEST['btnSubmit'] == 'Guardar' and $form->validate()) {
    $new_urna = $_REQUEST['new_urna'];
    $new_lista = $_REQUEST['new_lista'];
    $db->beginTransaction();
开发者ID:sergiokessler,项目名称:perio,代码行数:31,代码来源:carga.php

示例5: testInput

 public function testInput()
 {
     $form = new HTML_QuickForm2('filters', 'post', null, false);
     $foo = $form->addText('foo');
     $this->assertEquals($_POST['foo'], $foo->getValue());
     $foo->addFilter('trim');
     $this->assertEquals(trim($_POST['foo']), $foo->getValue());
 }
开发者ID:andreaswarnaar,项目名称:HTML_QuickForm2.1,代码行数:8,代码来源:FilterTest.php


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