本文整理汇总了PHP中Zend\Form\Element\Textarea::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Textarea::setName方法的具体用法?PHP Textarea::setName怎么用?PHP Textarea::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Form\Element\Textarea
的用法示例。
在下文中一共展示了Textarea::setName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getForm
public function getForm(array $default_status)
{
if (!$this->form) {
$hidId = new Element\Hidden();
$hidId->setName('userId');
$txtName = new Element\Text();
$txtName->setLabel('User Name')->setName("userName")->setAttribute('class', 'form-control');
$password = new Element\Password();
$password->setLabel('Password')->setName('password')->setAttribute('class', 'form-control');
$confirmPassword = new Element\Password();
$confirmPassword->setName('confirmPassword')->setLabel('Retype Password')->setAttribute('class', 'form-control');
$selectRole = new Element\Hidden('userRole');
$description = new Element\Textarea();
$description->setName('description')->setLabel('Description')->setAttribute('class', 'form-control');
$status = new Element\Select();
$status->setName('status')->setLabel('Status')->setAttribute('class', 'form-control')->setValueOptions($default_status);
$image = new Element\File();
$image->setName('image')->setLabel('Profile image');
$form = new Form();
$form->setAttribute('class', 'form-horizontal');
$form->setAttribute('enctype', 'multipart/form-data');
$form->add($hidId);
$form->add($txtName);
$form->add($password);
$form->add($confirmPassword);
$form->add($selectRole);
$form->add($description);
$form->add($status);
$form->add($image);
$this->form = $form;
}
return $this->form;
}
示例2: addElements
public function addElements()
{
$id = new Element\Hidden('id');
$title = new Element\Text('title');
$description = new Element\Textarea('description');
$postDate = new Element\Hidden('post_date');
$submit = new Element\Submit('submit');
$title->setName('title')->setAttributes(['placeholder' => 'Título', 'size' => 41])->setLabel('Título')->setLabelAttributes(array('class' => 'col-sm-2 control-label'));
$description->setName('description')->setAttributes(['placeholder' => 'Digite o conteúdo', 'rows' => 10, 'cols' => 40])->setLabel('Conteúdo')->setLabelAttributes(array('class' => 'col-sm-2 control-label'));
$submit->setAttribute('value', 'Salvar')->setAttribute('class', 'btn btn-info');
$this->add($id)->add($title)->add($description)->add($postDate)->add($submit);
}
示例3: render
/**
* @param UploaderModelInterface $model
* @param null $values
* @return string
* @throws InvalidArgumentException
*/
public function render($model, $values = null)
{
if (!$model instanceof UploaderModelInterface) {
throw new InvalidArgumentException("Unsupportable type of model, required type UploaderModelInterface");
}
$textArea = new Textarea();
$textArea->setName('response');
$textAreaViewHelper = new FormTextarea();
$jsonEncoder = new Json();
$value = $jsonEncoder->encode($model->getVariables());
$textArea->setValue($value);
return $textAreaViewHelper->render($textArea);
}
示例4: __construct
public function __construct(EntityManager $em)
{
parent::__construct();
$this->em = $em;
$hiddenElement = new Element\Hidden('id');
$hiddenElement->setName('id')->setAttributes(array('type' => 'hidden'));
$this->add($hiddenElement, array());
$this->add(array('name' => 'name', 'options' => array('label' => 'Product Name'), 'attributes' => array('type' => 'text', 'placeholder' => 'Product Name', 'class' => 'form-control', 'id' => 'name', 'required' => 'required', 'autofocus' => 'autofocus')))->add(array('name' => 'sku', 'options' => array('label' => 'SKU'), 'attributes' => array('type' => 'text', 'placeholder' => 'SKU', 'class' => 'form-control', 'id' => 'sku', 'required' => 'required')))->add(array('name' => 'price', 'options' => array('label' => 'Product Price', 'help' => 'Price must be of type float i.e 50.00'), 'attributes' => array('type' => 'text', 'placeholder' => 'Product Price', 'class' => 'form-control', 'id' => 'price', 'required' => 'required')))->add(array('type' => 'Zend\\Form\\Element\\Number', 'name' => 'qty', 'options' => array('label' => 'Qty in Stock'), 'attributes' => array('min' => '0', 'step' => '1', 'placeholder' => 'Qty in Stock', 'class' => 'form-control', 'id' => 'qty', 'required' => 'required')))->add(array('type' => 'Zend\\Form\\Element\\Csrf', 'name' => 'csrf'));
$textAreaElement = new Element\Textarea('description');
$textAreaElement->setName('description')->setLabel('Product Description')->setAttributes(array('type' => 'textarea', 'placeholder' => 'Product Description', 'class' => 'form-control', 'rows' => '3', 'id' => 'description', 'required' => 'required'));
$this->add($textAreaElement, array());
$submitElement = new Element\Button('submit');
$submitElement->setName('submit')->setLabel('Save Product')->setAttributes(array('type' => 'submit', 'class' => 'btn btn-primary btn-sm', 'id' => 'addProduct'));
$this->add($submitElement, array('priority' => -100));
}
示例5: __construct
public function __construct()
{
parent::__construct();
$this->setAttribute('method', 'post');
$this->setAttribute('action', '/user/dashboard/post/create');
$this->setAttribute('id', 'user-post-form');
$title = new Text();
$title->setName('title')->setLabel('Title')->setAttribute('required', 'true');
$body = new Textarea();
$body->setName('body')->setAttributes(array('placeholder' => 'Your post content...', 'rows' => 8, 'resizable' => 'false', 'required' => 'true'));
$csrf = new Csrf();
$csrf->setName('prev');
$submit = new Submit();
$submit->setName('submit')->setValue('Create')->setAttribute('class', 'btn btn-info');
$this->add($title)->add($body)->add($csrf)->add($submit);
foreach ($this->elements as $element) {
if (!$element instanceof Submit) {
$element->setAttribute('class', 'form-control');
}
}
}
示例6: getForm
public function getForm(array $currencies)
{
if (!$this->form) {
$hidId = new Element\Hidden();
$hidId->setName('receiveVoucherId');
$txtVoucherNo = new Element\Text();
$txtVoucherNo->setLabel('Number')->setName("voucherNo")->setAttribute('class', 'form-control text-center')->setAttribute('readonly', 'readonly');
$txtVoucherDate = new Element\Date('voucherDate');
$txtVoucherDate->setLabel('Date')->setAttributes(array('class' => 'form-control', 'allowPastDates' => true, 'momentConfig' => array('format' => 'YYYY-MM-DD')));
$txtAccountType = new Element\Hidden('accountType');
$txtDescription = new Element\Textarea();
$txtDescription->setName("description")->setLabel('Description')->setAttribute('class', 'form-control');
$txtAmount = new Element\Number();
$txtAmount->setName("amount")->setLabel('Amount')->setAttribute('class', 'form-control')->setattributes(array('min' => '10', 'max' => '99999999999', 'step' => '1'));
$cboCurrency = new Element\Select();
$cboCurrency->setName('currencyId')->setLabel('Currency Type')->setAttribute('class', 'form-control')->setEmptyOption('-- Choose --')->setValueOptions($currencies);
$txtDepositBy = new Element\Hidden();
$txtDepositBy->setName("depositBy");
$txtReason = new Element\Textarea();
$txtReason->setName('reason');
$txtGroupCode = new Element\Text();
$txtGroupCode->setName('group_code')->setLabel('Group Code (optional)')->setAttribute('class', 'form-control');
$form = new Form();
$form->setAttribute('role', 'form');
$form->add($hidId);
$form->add($txtVoucherNo);
$form->add($txtVoucherDate);
$form->add($txtAccountType);
$form->add($txtDescription);
$form->add($txtAmount);
$form->add($cboCurrency);
$form->add($txtDepositBy);
$form->add($txtReason);
$form->add($txtGroupCode);
$this->form = $form;
}
return $this->form;
}
示例7: __construct
public function __construct()
{
parent::__construct();
$this->setAttribute('method', 'post');
$this->setAttribute('action', '/user/dashboard/messages/create');
$this->setAttribute('class', 'form-horizontal');
$this->setAttribute('id', 'user-message-form');
$to = new Text();
$to->setName('recipient')->setLabel('Recipients')->setAttribute('id', 'recipients');
$subject = new Text();
$subject->setName('subject')->setLabel('Subject');
$body = new Textarea();
$body->setName('body')->setAttributes(array('placeholder' => 'Your message...', 'rows' => 4));
$csrf = new Csrf();
$csrf->setName('prev');
$submit = new Submit();
$submit->setName('submit')->setValue('Send');
$this->add($to)->add($subject)->add($body)->add($csrf)->add($submit);
foreach ($this->elements as $element) {
if (!$element instanceof Submit) {
$element->setAttribute('class', 'form-control');
}
}
}
示例8: render
public function render($formPV, $id)
{
$form = new Form();
$form->setAttribute('id', $id);
$inputFilter = new \Zend\InputFilter\InputFilter();
$factory = new InputFactory();
foreach ($formPV as $element) {
if (isset($element->line_text)) {
$attributes = $element->line_text[0];
$name = isset($attributes->name) ? $attributes->name : '';
$type = isset($attributes->type) ? $attributes->type : '';
$position = isset($attributes->order) ? $attributes->order : '';
$placeholder = isset($attributes->data->placeholder) ? $attributes->data->placeholder : '';
$label = isset($attributes->data->label) ? $attributes->data->label : '';
//$required = ($attributes->data->required == 'true') ? true : false ;
$required = false;
$class = isset($attributes->data->class) ? $attributes->data->class : '';
$id = isset($attributes->data->id) ? $attributes->data->id : '';
$lengthMin = isset($attributes->data->length) ? $attributes->data->length->min : '';
$lengthMax = isset($attributes->data->length) ? $attributes->data->length->max : '';
$element = new Element\Text($name);
$element->setName($label);
$element->setLabel($label);
$element->setAttributes(array('placeholder' => $placeholder, 'required' => $required, 'class' => $class, 'id' => $id));
$form->add($element);
$options = array();
$options['encoding'] = 'UTF-8';
if ($lengthMin && $lengthMin > 0) {
$options['min'] = $lengthMin;
}
if ($lengthMax && $lengthMax > $lengthMin) {
$options['max'] = $lengthMax;
$element->setAttribute('maxlength', $lengthMax);
$options['messages'] = array(\Zend\Validator\StringLength::TOO_LONG => sprintf($this->getServiceManager()->get('translator')->translate('This field contains more than %s characters', 'playgroundgame'), $lengthMax));
}
$inputFilter->add($factory->createInput(array('name' => $name, 'required' => $required, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => $options)))));
}
if (isset($element->line_email)) {
$attributes = $element->line_email[0];
$name = isset($attributes->name) ? $attributes->name : '';
$type = isset($attributes->type) ? $attributes->type : '';
$position = isset($attributes->order) ? $attributes->order : '';
$placeholder = isset($attributes->data->placeholder) ? $attributes->data->placeholder : '';
$label = isset($attributes->data->label) ? $attributes->data->label : '';
//$required = ($attributes->data->required == 'true') ? true : false ;
$required = false;
$class = isset($attributes->data->class) ? $attributes->data->class : '';
$id = isset($attributes->data->id) ? $attributes->data->id : '';
$lengthMin = isset($attributes->data->length) ? $attributes->data->length->min : '';
$lengthMax = isset($attributes->data->length) ? $attributes->data->length->max : '';
$element = new Element\Email($name);
$element->setLabel($label);
$element->setName($label);
$element->setAttributes(array('placeholder' => $placeholder, 'required' => $required, 'class' => $class, 'id' => $id));
$form->add($element);
$options = array();
$options['encoding'] = 'UTF-8';
if ($lengthMin && $lengthMin > 0) {
$options['min'] = $lengthMin;
}
if ($lengthMax && $lengthMax > $lengthMin) {
$options['max'] = $lengthMax;
$element->setAttribute('maxlength', $lengthMax);
$options['messages'] = array(\Zend\Validator\StringLength::TOO_LONG => sprintf($this->getServiceManager()->get('translator')->translate('This field contains more than %s characters', 'playgroundgame'), $lengthMax));
}
$inputFilter->add($factory->createInput(array('name' => $name, 'required' => $required, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => $options)))));
}
if (isset($element->line_checkbox)) {
$attributes = $element->line_checkbox[0];
$name = isset($attributes->name) ? $attributes->name : '';
$type = isset($attributes->type) ? $attributes->type : '';
$position = isset($attributes->order) ? $attributes->order : '';
$label = isset($attributes->data->label) ? $attributes->data->label : '';
// $required = ($attributes->data->required == 'yes') ? true : false;
$required = false;
$class = isset($attributes->data->class) ? $attributes->data->class : '';
$id = isset($attributes->data->id) ? $attributes->data->id : '';
$lengthMin = isset($attributes->data->length) ? $attributes->data->length->min : '';
$lengthMax = isset($attributes->data->length) ? $attributes->data->length->max : '';
$innerData = isset($attributes->data->innerData) ? $attributes->data->innerData : array();
$element = new Element\MultiCheckbox($name);
$element->setLabel($label);
$element->setName($label);
$element->setAttributes(array('name' => $name, 'required' => $required, 'allowEmpty' => !$required, 'class' => $class, 'id' => $id));
$values = array();
foreach ($innerData as $value) {
$values[] = $value->label;
}
$element->setValueOptions($values);
$form->add($element);
$options = array();
$options['encoding'] = 'UTF-8';
$inputFilter->add($factory->createInput(array('name' => $name, 'required' => $required, 'allowEmpty' => !$required)));
}
if (isset($element->line_paragraph)) {
$attributes = $element->line_paragraph[0];
$name = isset($attributes->name) ? $attributes->name : '';
$type = isset($attributes->type) ? $attributes->type : '';
$position = isset($attributes->order) ? $attributes->order : '';
$placeholder = isset($attributes->data->placeholder) ? $attributes->data->placeholder : '';
//.........这里部分代码省略.........