本文整理汇总了PHP中Zend\Form\Element::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Element::setValue方法的具体用法?PHP Element::setValue怎么用?PHP Element::setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Form\Element
的用法示例。
在下文中一共展示了Element::setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function __construct($entityManager)
{
parent::__construct('contatoForm');
$this->setAttribute('method', 'post');
$this->setAttribute('id', 'fileupload');
$this->setEntityManager($entityManager);
$idContato = new Element('idContato');
$idContato->setLabel('Contato');
$idContato->setAttributes(array('name' => 'idContato', 'id' => 'idContato', 'type' => 'hidden'));
$this->add($idContato);
$email = new Element('email');
$email->setLabel('Email');
$email->setAttributes(array('name' => 'email', 'id' => 'email', 'type' => 'text', 'class' => 'form-control'));
$this->add($email);
$assunto = new Element('assunto');
$assunto->setLabel('Assunto');
$assunto->setAttributes(array('name' => 'assunto', 'id' => 'assunto', 'type' => 'text', 'class' => 'form-control'));
$this->add($assunto);
$mensagem = new Element\Textarea('mensagem');
$mensagem->setLabel('Mensagem');
$mensagem->setAttributes(array('name' => 'mensagem', 'id' => 'mensagem', 'type' => 'textarea', 'class' => 'form-control'));
$this->add($mensagem);
$submit = new Element('submit');
$submit->setValue('Salvar');
$submit->setAttributes(array('type' => 'submit'));
$this->add($submit);
}
示例2: prepare
public function prepare()
{
$username = new Element('username');
$username->setLabel($this->translate('Your username'));
$username->setAttributes(['type' => 'text', 'icon' => 'user', 'class' => 'form-control']);
$email = new Element('email');
$email->setLabel($this->translate('Email (used to login)'));
$email->setAttributes(['type' => 'text', 'icon' => 'envelope', 'class' => 'form-control']);
$password = new Element('password');
$password->setLabel($this->translate('Password'));
$password->setAttributes(['type' => 'password', 'id' => 'password', 'icon' => 'lock', 'class' => 'form-control']);
$confirmPassword = new Element('confirm-password');
$confirmPassword->setLabel($this->translate('Confirm Password'));
$confirmPassword->setAttributes(['type' => 'password', 'icon' => 'lock', 'class' => 'form-control']);
$send = new Element('send');
$send->setValue($this->translate('Create My Account'));
$send->setAttributes(['type' => 'submit', 'class' => 'btn btn-default']);
$this->add($username);
$this->add($email);
$this->add($password);
$this->add($confirmPassword);
$this->addCaptcha();
$this->add($send);
parent::prepare();
}
示例3: getCompleteElement
public function getCompleteElement()
{
$element = new Element('foo');
$element->setAttributes(array('accept' => 'value', 'accesskey' => 'value', 'alt' => 'value', 'autocomplete' => 'on', 'autofocus' => 'autofocus', 'checked' => 'checked', 'class' => 'value', 'contenteditable' => 'value', 'contextmenu' => 'value', 'dir' => 'value', 'dirname' => 'value', 'disabled' => 'disabled', 'draggable' => 'value', 'dropzone' => 'value', 'form' => 'value', 'formaction' => 'value', 'formenctype' => 'value', 'formmethod' => 'value', 'formnovalidate' => 'value', 'formtarget' => 'value', 'height' => 'value', 'hidden' => 'value', 'id' => 'value', 'lang' => 'value', 'list' => 'value', 'max' => 'value', 'maxlength' => 'value', 'min' => 'value', 'multiple' => 'multiple', 'name' => 'value', 'onabort' => 'value', 'onblur' => 'value', 'oncanplay' => 'value', 'oncanplaythrough' => 'value', 'onchange' => 'value', 'onclick' => 'value', 'oncontextmenu' => 'value', 'ondblclick' => 'value', 'ondrag' => 'value', 'ondragend' => 'value', 'ondragenter' => 'value', 'ondragleave' => 'value', 'ondragover' => 'value', 'ondragstart' => 'value', 'ondrop' => 'value', 'ondurationchange' => 'value', 'onemptied' => 'value', 'onended' => 'value', 'onerror' => 'value', 'onfocus' => 'value', 'oninput' => 'value', 'oninvalid' => 'value', 'onkeydown' => 'value', 'onkeypress' => 'value', 'onkeyup' => 'value', 'onload' => 'value', 'onloadeddata' => 'value', 'onloadedmetadata' => 'value', 'onloadstart' => 'value', 'onmousedown' => 'value', 'onmousemove' => 'value', 'onmouseout' => 'value', 'onmouseover' => 'value', 'onmouseup' => 'value', 'onmousewheel' => 'value', 'onpause' => 'value', 'onplay' => 'value', 'onplaying' => 'value', 'onprogress' => 'value', 'onratechange' => 'value', 'onreadystatechange' => 'value', 'onreset' => 'value', 'onscroll' => 'value', 'onseeked' => 'value', 'onseeking' => 'value', 'onselect' => 'value', 'onshow' => 'value', 'onstalled' => 'value', 'onsubmit' => 'value', 'onsuspend' => 'value', 'ontimeupdate' => 'value', 'onvolumechange' => 'value', 'onwaiting' => 'value', 'pattern' => 'value', 'placeholder' => 'value', 'readonly' => 'readonly', 'required' => 'required', 'size' => 'value', 'spellcheck' => 'value', 'src' => 'value', 'step' => 'value', 'style' => 'value', 'tabindex' => 'value', 'title' => 'value', 'width' => 'value', 'wrap' => 'value', 'xml:base' => 'value', 'xml:lang' => 'value', 'xml:space' => 'value', 'data-some-key' => 'value', 'option' => 'value', 'optgroup' => 'value', 'arbitrary' => 'value', 'meta' => 'value'));
$element->setValue('value');
return $element;
}
示例4: getCompleteElement
public function getCompleteElement()
{
$element = new Element('foo');
$element->setAttributes(array('accept' => 'value', 'alt' => 'value', 'autocomplete' => 'on', 'autofocus' => 'autofocus', 'checked' => 'checked', 'dirname' => 'value', 'disabled' => 'disabled', 'form' => 'value', 'formaction' => 'value', 'formenctype' => 'value', 'formmethod' => 'value', 'formnovalidate' => 'value', 'formtarget' => 'value', 'height' => 'value', 'id' => 'value', 'list' => 'value', 'max' => 'value', 'maxlength' => 'value', 'min' => 'value', 'multiple' => 'multiple', 'name' => 'value', 'pattern' => 'value', 'placeholder' => 'value', 'readonly' => 'readonly', 'required' => 'required', 'size' => 'value', 'src' => 'value', 'step' => 'value', 'width' => 'value'));
$element->setValue('value');
return $element;
}
示例5: updateAction
public function updateAction()
{
$id = $this->params()->fromRoute('id');
if (!$id) {
return $this->redirect()->toRoute('album_dm/default', array('controller' => 'album-dm', 'action' => 'index'));
}
$entityManager = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
try {
$repository = $entityManager->getRepository('AlbumDm\\Entity\\Album');
$album = $repository->find($id);
} catch (\Exception $ex) {
echo $ex->getMessage();
// this never will be seen if you don't comment the redirect
return $this->redirect()->toRoute('album_dm/default', array('controller' => 'album-dm', 'action' => 'index'));
}
$builder = new DoctrineAnnotationBuilder($entityManager);
$form = $builder->createForm($album);
$form->setHydrator(new DoctrineHydrator($entityManager, 'AlbumDm\\Entity\\Album'));
$send = new Element('submit');
$send->setValue('Go');
// submit
$send->setAttributes(array('type' => 'submit'));
$form->add($send);
$form->bind($album);
$request = $this->getRequest();
if ($request->isPost()) {
$form->setData($request->getPost());
if ($form->isValid()) {
$entityManager->persist($album);
$entityManager->flush();
return $this->redirect()->toRoute('album_dm/default', array('controller' => 'album-dm', 'action' => 'index'));
}
}
return new ViewModel(array('form' => $form, 'id' => $id));
}
示例6: setValue
/**
* {@inheritDoc}
*
* @todo do we need to set value in static element?
* @throws Exception\BadMethodCallException
*/
public function setValue($value)
{
if ($this->value !== null && $value !== null) {
//throw new Exception\BadMethodCallException("Can't set value for static form element");
}
return parent::setValue($value);
}
示例7: __construct
public function __construct()
{
parent::__construct('Player');
$name = new TextElement('name');
$name->setLabel('Name');
$this->add($name);
$submit = new Element('submit');
$submit->setValue('Speichern');
$submit->setAttributes(array('type' => 'submit'));
$this->add($submit);
}
示例8: prepare
public function prepare()
{
$email = new Element('passwordreset-email');
$email->setLabel($this->translate('Email'));
$email->setAttributes(['id' => 'passwordreset-email', 'type' => 'text', 'icon' => 'envelope', 'class' => 'form-control']);
$this->add($email);
$send = new Element('send');
$send->setValue('Request password reset');
$send->setAttributes(['type' => 'submit', 'class' => 'btn btn-default']);
$this->add($send);
parent::prepare();
}
示例9: __construct
/**
* @param Player[] $players
*/
public function __construct($players)
{
parent::__construct('PlayerToTournament');
$select = new Select('player');
$options = array();
foreach ($players as $player) {
$options[$player->getId()] = $player->getName();
}
$select->setValueOptions($options);
$this->add($select);
$submit = new Element('submit');
$submit->setValue('Hinzufügen');
$submit->setAttributes(array('type' => 'submit'));
$this->add($submit);
}
示例10: prepare
public function prepare()
{
$password = new Element('password');
$password->setLabel($this->translate('Password'));
$password->setAttributes(['type' => 'password', 'id' => 'password', 'icon' => 'lock', 'class' => 'form-control']);
$confirmPassword = new Element('confirm-password');
$confirmPassword->setLabel($this->translate('Confirm Password'));
$confirmPassword->setAttributes(['type' => 'password', 'icon' => 'lock', 'class' => 'form-control']);
$send = new Element('send');
$send->setValue($this->translate('Update password'));
$send->setAttributes(['type' => 'submit', 'class' => 'btn btn-success']);
$this->add($password);
$this->add($confirmPassword);
$this->add($send);
parent::prepare();
}
示例11: __construct
/**
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function __construct($entityManager)
{
parent::__construct('contatoSearchForm');
$this->setAttribute('method', 'post');
$this->setAttribute('id', 'contatoSearch');
$this->setAttribute('class', 'form-inline');
$this->setEntityManager($entityManager);
$nome = new Element('likeField');
$nome->setAttributes(array('name' => 'likeField', 'id' => 'likeField', 'type' => 'text', 'data-ng-model' => 'list.search'));
$nome->setLabel('Palavra Chave ');
$this->add($nome);
$submit = new Element('clear');
$submit->setValue('Limpar');
$submit->setAttributes(array('type' => 'button', 'data-ng-click' => 'list.clearSearch()'));
$this->add($submit);
}
示例12: prepare
public function prepare()
{
$name = new Element('email');
$name->setLabel('Your email');
$name->setAttributes(['type' => 'text', 'icon' => 'envelope', 'class' => 'form-control']);
$message = new Element('message');
$message->setLabel($this->translate('Your question or feedback'));
$message->setAttributes(['type' => 'textarea', 'class' => 'form-control']);
$send = new Element('send');
$send->setValue('Submit');
$send->setAttributes(['type' => 'submit', 'class' => 'btn btn-default']);
$this->add($name);
$this->add($message);
$this->addCaptcha();
$this->add($send);
parent::prepare();
}
示例13: prepare
public function prepare()
{
$email = new Element('login-email');
$email->setLabel($this->translate('Email'));
$email->setAttributes(['id' => 'login-email-standard', 'type' => 'text', 'icon' => 'envelope', 'class' => 'form-control']);
$password = new Element('login-password');
$password->setLabel($this->translate('Password'));
$password->setAttributes(['type' => 'password', 'id' => 'login-password-standard', 'icon' => 'lock', 'class' => 'form-control']);
$rememberMe = new Checkbox('rememberme');
$rememberMe->setLabel($this->translate('Remember me'));
$send = new Element('send');
$send->setValue('Login');
$send->setAttributes(['type' => 'submit', 'class' => 'btn btn-default']);
$this->add($email);
$this->add($password);
$this->add($rememberMe);
$this->add($send);
parent::prepare();
}
示例14: getForm
public function getForm($article, $entityManager, $myEntity, $action)
{
$builder = new DoctrineAnnotationBuilder($entityManager);
$form = $builder->createForm($article);
//!!!!!! Start !!!!! Added to make the association tables work with select
foreach ($form->getElements() as $element) {
if (method_exists($element, 'getProxy')) {
$proxy = $element->getProxy();
if (method_exists($proxy, 'setObjectManager')) {
$proxy->setObjectManager($entityManager);
}
}
}
$form->setHydrator(new DoctrineHydrator($entityManager, $myEntity));
$oName = new Element('name');
$oName->setAttributes(array('type' => 'text', 'maxlength' => 255));
$oName->setOptions(array('label' => 'Название'));
$form->add($oName, array('priority' => 1000));
$oDescription = new Element('description');
$oDescription->setAttributes(array('type' => 'text', 'maxlength' => 255));
$oDescription->setOptions(array('label' => 'Описание'));
$form->add($oDescription, array('priority' => 999));
$send = new Element('send');
$send->setValue($action);
// submit
$send->setAttributes(array('type' => 'submit'));
$form->add($send);
foreach ($form->getElements() as $element) {
$element->setAttribute('id', $element->getName());
$element->setAttribute('class', 'form-control');
/*if ($element->getLabel() === null) {
$element->setOptions(array('add-on-div' => array('class' => 'col-sm-offset-2 col-sm-10'), ));
} else {
$element->setOptions(array( 'add-on-div' => array('class' => 'col-sm-10'),
'label_attributes' => array('class' => 'col-sm-2 control-label'),
));
}*/
}
return $form;
}
示例15: Element
$name = new Element('name');
$name->setLabel('Your name');
$name->setAttributes(array('type' => 'text'));
$email = new Element\Email('email');
$email->setLabel('Your email address');
$subject = new Element('subject');
$subject->setLabel('Subject');
$subject->setAttributes(array('type' => 'text'));
$message = new Element\Textarea('message');
$message->setLabel('Message');
$captcha = new Element\Captcha('captcha');
$captcha->setCaptcha(new Captcha\Dumb());
$captcha->setLabel('Please verify you are human');
$csrf = new Element\Csrf('security');
$send = new Element('send');
$send->setValue('Submit');
$send->setAttributes(array('type' => 'submit'));
$form = new Form('contact');
$form->add($name);
$form->add($email);
$form->add($subject);
$form->add($message);
$form->add($captcha);
$form->add($csrf);
$form->add($send);
$nameInput = new Input('name');
// configure input... and all others
$inputFilter = new InputFilter();
// attach all inputs
$form->setInputFilter($inputFilter);
$sender = new Fieldset('sender');