本文整理汇总了PHP中Zend\Form\Form::render方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::render方法的具体用法?PHP Form::render怎么用?PHP Form::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Form\Form
的用法示例。
在下文中一共展示了Form::render方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testEmptyFormNameShouldNotRenderEmptyFormId
public function testEmptyFormNameShouldNotRenderEmptyFormId()
{
$form = new Form();
$form->setMethod('post')->setAction('/foo/bar')->setView($this->getView());
$html = $form->render();
$this->assertNotContains('id=""', $html, $html);
}
示例2: testCaptchaShouldRenderFullyQualifiedElementName
/**
* @group ZF-4038
*/
public function testCaptchaShouldRenderFullyQualifiedElementName()
{
$form = new Form();
$form->addElement($this->element)->setElementsBelongTo('bar');
$html = $form->render(new View());
$this->assertContains('name="bar[foo', $html, $html);
$this->assertContains('id="bar-foo-', $html, $html);
$this->form = $form;
}
示例3: testCanPopulateCheckboxOptionsFromPostedData
/**
* @group ZF-2828
*/
public function testCanPopulateCheckboxOptionsFromPostedData()
{
$form = new Form(array('elements' => array('100_1' => array('MultiCheckbox', array('multiOptions' => array('100_1_1' => 'Agriculture', '100_1_2' => 'Automotive', '100_1_12' => 'Chemical', '100_1_13' => 'Communications'), 'required' => true)))));
$data = array('100_1' => array('100_1_1', '100_1_2', '100_1_12', '100_1_13'));
$form->populate($data);
$html = $form->render($this->getView());
foreach ($form->getElement('100_1')->getMultiOptions() as $key => $value) {
if (!preg_match('#(<input[^>]*' . $key . '[^>]*>)#', $html, $m)) {
$this->fail('Missing input for a given multi option: ' . $html);
}
$this->assertContains('checked="checked"', $m[1]);
}
}
示例4: testSubFormGetsUniqueIdWithName
/**
* @group ZF-2950
*/
public function testSubFormGetsUniqueIdWithName()
{
$form = new Form();
$form->setView($this->getView())->setName('testform')->addSubForm(new \Zend\Form\SubForm(), 'testform');
$html = $form->render();
$this->assertContains('<dt id="testform-label"> </dt>', $html);
$this->assertContains('<dd id="testform-element">', $html);
}
示例5: testRenderedSubFormDtShouldContainNoBreakSpace
/**
* @group ZF-3272
*/
public function testRenderedSubFormDtShouldContainNoBreakSpace()
{
$subForm = new SubForm(array('elements' => array('foo' => 'text', 'bar' => 'text')));
$form = new Form();
$form->addSubForm($subForm, 'foobar')->setView(new View());
$html = $form->render();
$this->assertContains('> </dt>', $html);
}