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


PHP Form::prepare方法代码示例

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


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

示例1: __invoke

 /**
  * Display a Form
  *
  * @param  \Zend\Form\Form $form
  * @return string
  */
 public function __invoke(ZendForm $form)
 {
     $form->prepare();
     $html = $this->getFormHelper()->openTag($form);
     $html .= $this->render($form->getIterator());
     return $html . $this->getFormHelper()->closeTag();
 }
开发者ID:suitedJK,项目名称:ZfcTwitterBootstrap,代码行数:13,代码来源:Form.php

示例2: __invoke

 /**
  * Outputs message depending on flag
  *
  * @return string
  */
 public function __invoke(Form $form, $url, $class = 'form-horizontal')
 {
     $form->setAttribute('action', $url);
     $form->setAttribute('class', $class);
     $form->prepare();
     $output = $this->getView()->form()->openTag($form);
     $submitElements = array();
     foreach ($form as $element) {
         if ($element instanceof Submit) {
             $submitElements[] = $element;
         } elseif ($element instanceof Csrf || $element instanceof Hidden) {
             $output .= $this->getView()->formElement($element);
         } else {
             $element->setLabelAttributes(array('class' => 'control-label'));
             $output .= '<div class="control-group">';
             $output .= $this->getView()->formLabel($element);
             $output .= '<div class="controls">';
             $output .= $this->getView()->formElement($element);
             $output .= $this->getView()->formElementErrors($element);
             $output .= '</div>';
             $output .= '</div>';
         }
     }
     $output .= '<div class="form-actions">';
     foreach ($submitElements as $element) {
         $output .= $this->getView()->formElement($element) . '&nbsp;';
     }
     $output .= '</div>';
     $output .= $this->getView()->form()->closeTag();
     return $output;
 }
开发者ID:huanhuashengling,项目名称:ipc2013-testing,代码行数:36,代码来源:ShowForm.php

示例3: __invoke

 public function __invoke(Form $form, $action)
 {
     $form->setAttribute('method', 'post');
     $form->setAttribute('action', $action);
     $form->prepare();
     $view = $this->getView();
     $html = '';
     $html .= $view->form()->openTag($form);
     $html .= '<table class="default-table">';
     $formElements = $form->getElements();
     foreach ($formElements as $formElement) {
         if ($formElement instanceof Checkbox) {
             $html .= $view->formRowCheckbox($form, $formElement);
         } else {
             if ($formElement instanceof Submit) {
                 $html .= $view->formRowSubmit($form, $formElement);
             } else {
                 $html .= $view->formRowDefault($form, $formElement);
             }
         }
     }
     $html .= '</table>';
     $html .= $view->form()->closeTag();
     return $html;
 }
开发者ID:Mendim,项目名称:ep3-bs,代码行数:25,代码来源:FormDefault.php

示例4: testResetPasswordValueIfFormIsNotValid

 public function testResetPasswordValueIfFormIsNotValid()
 {
     $this->form->add(array('type' => 'Zend\\Form\\Element\\Password', 'name' => 'password'));
     $this->form->add(array('type' => 'Zend\\Form\\Element\\Email', 'name' => 'email'));
     $this->form->setData(array('password' => 'azerty', 'email' => 'wrongEmail'));
     $this->assertFalse($this->form->isValid());
     $this->form->prepare();
     $this->assertEquals('', $this->form->get('password')->getValue());
 }
开发者ID:razvansividra,项目名称:pnlzf2-1,代码行数:9,代码来源:FormTest.php

示例5: prepare

 public function prepare()
 {
     if ($this->isPrepared) {
         return $this;
     }
     $email = new Email('email');
     $email->setLabel('Email');
     $password = new Password('password');
     $password->setLabel('Password');
     $submit = new Submit('login');
     $submit->setValue('Login');
     $this->add($email)->add($password)->add($submit);
     return parent::prepare();
 }
开发者ID:rb-cohen,项目名称:jzform,代码行数:14,代码来源:simple.php

示例6: __invoke

 /**
  * @param ZendForm $form
  * @param boolean  $groupActions
  *
  * @return Form
  */
 public function __invoke(ZendForm $form, $groupActions = false)
 {
     $this->formActionElements = array();
     $form->prepare();
     $this->setElement(new HtmlElement('form'));
     $this->getElement()->setAttributes(array('action' => '', 'method' => 'GET'));
     if (!$form->hasAttribute('id')) {
         $form->setAttribute('id', $form->getName());
     }
     $this->getElement()->addAttributes($form->getAttributes());
     $this->renderElements($form->getIterator(), $groupActions);
     $this->renderFormActions();
     return clone $this;
 }
开发者ID:spoonx,项目名称:sxbootstrap,代码行数:20,代码来源:Form.php

示例7: __invoke

 /**
  * Outputs message depending on flag
  *
  * @return string
  */
 public function __invoke(Form $form)
 {
     $form->prepare();
     $output = $this->getView()->form()->openTag($form);
     foreach ($form as $element) {
         $output .= $this->renderElement($element);
     }
     $output .= '<div class="form-group"><div class="col-sm-2"></div><div class="col-sm-2">';
     foreach ($this->submitElements as $element) {
         $element->setAttribute('class', 'form-control btn-primary btn-lg');
         $output .= $this->getView()->formElement($element) . '&nbsp;';
     }
     $output .= '</div></div>';
     $output .= $this->getView()->form()->closeTag();
     return $output;
 }
开发者ID:krsreenatha,项目名称:php.ug,代码行数:21,代码来源:ShowForm.php

示例8: prepare

 public function prepare()
 {
     if ($this->isPrepared) {
         return $this;
     }
     $email = new Email('email');
     $email->setLabel('Email');
     $password = new Password('password');
     $password->setLabel('P2assword');
     $member = new Radio('memberOf');
     $member->setValueOptions(array('__model.id__' => '__model.name__'));
     $memberOfTemplate = new TemplateCollection('memberOfTemplate');
     $memberOfTemplate->setTargetElement($member);
     $memberOf = new Fieldset('memberOfGroup');
     $memberOf->setLabel('Member of')->add($memberOfTemplate);
     $submit = new Submit('register');
     $submit->setValue('Register');
     $this->add($memberOf)->add($submit);
     return parent::prepare();
 }
开发者ID:rb-cohen,项目名称:jzform,代码行数:20,代码来源:template.php

示例9: prepare

 public function prepare()
 {
     parent::prepare();
     return $this;
 }
开发者ID:pixlr,项目名称:SpeckCatalog,代码行数:5,代码来源:AbstractForm.php

示例10: Form

            document.getElementById('pg-text-2').innerHTML = 'Upload done';
        }
    </script>
</head>
<body>
<?php 
$file = new Element\File('file');
$file->setLabel('File');
$progress_key = new Element\Hidden('progress_key');
$progress_key->setAttribute('id', 'progress_key');
$progress_key->setValue(md5(uniqid(rand())));
$submit = new Element\Submit('submit');
$submit->setValue('Upload!');
$form = new Form("ZendForm");
$form->setAttributes(array('enctype' => 'multipart/form-data', 'action' => 'ZendForm.php', 'target' => 'uploadTarget', 'onsubmit' => 'observeProgress();'));
$form->prepare();
$formhelper = new Helper\Form();
$formfile = new Helper\FormFile();
$formhidden = new Helper\FormHidden();
$formsubmit = new Helper\FormSubmit();
echo $formhelper->openTag($form);
echo $formhidden($progress_key);
echo $formfile($file);
echo $formsubmit($submit);
echo $formhelper->closeTag();
?>
<iframe name="uploadTarget"></iframe>

<div id="progressbar">
    <div class="pg-progressbar">
        <div class="pg-progress" id="pg-percent">
开发者ID:nieldm,项目名称:zf2,代码行数:31,代码来源:ZendForm.php

示例11: prepare

 /**
  * @see Zend\Form\Element:prepare()
  */
 public function prepare()
 {
     parent::prepare();
     self::workOnElement($this->getInputfilter(), $this);
 }
开发者ID:advertikon,项目名称:advertikon,代码行数:8,代码来源:Form.php

示例12: prepare

 /**
  * {@inheritDoc}
  */
 public function prepare()
 {
     $this->prepareElementGroup($this, $this->extract(), $this->elementGroup);
     return parent::prepare();
 }
开发者ID:coolms,项目名称:common,代码行数:8,代码来源:Form.php

示例13: testSettingSomeDataButNoneForCollectionReturnsSpecifiedNumberOfElementsAfterPrepare

 public function testSettingSomeDataButNoneForCollectionReturnsSpecifiedNumberOfElementsAfterPrepare()
 {
     $form = new Form();
     $form->add(new Element\Text('input'));
     $form->add(array('name' => 'names', 'type' => 'Collection', 'options' => array('target_element' => new Element\Text(), 'count' => 2)));
     $form->setData(array('input' => 'foo'));
     $this->assertCount(0, $form->get('names'));
     $form->prepare();
     $this->assertCount(2, $form->get('names'));
 }
开发者ID:pnaq57,项目名称:zf2demo,代码行数:10,代码来源:CollectionTest.php

示例14: prepare

 /** prepare **/
 public function prepare()
 {
     $this->getEventManager()->trigger('pre.' . __FUNCTION__, $this, (array) $this->getformOption());
     parent::prepare();
     $this->getEventManager()->trigger('post.' . __FUNCTION__, $this, (array) $this->getformOption());
 }
开发者ID:renatosalvatori,项目名称:Zf2datatable,代码行数:7,代码来源:EventsForm.php

示例15: prepare

 /**
  * @see \Zend\Form\Form::prepare()
  */
 public function prepare()
 {
     if ($this->isPrepared) {
         return $this;
     }
     parent::prepare();
     $this->getEventManager()->trigger(static::EVENT_PREPARE, $this);
     return $this;
 }
开发者ID:cross-solution,项目名称:yawik,代码行数:12,代码来源:Form.php


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