标签: zend-form

Zend_Form ::如何从zend表单中删除所有标签?$ title-> removeDecorator('Label'); 一个但是所有元素?

Zend_Form ::如何从zend表单中删除所有标签?$title->removeDecorator('Label');一个但是所有元素?

谢谢

zend-framework zend-form

0
推荐指数
1
解决办法
4447
查看次数

Zend Framework:使用Zend Form Element上传文件

此时我正在使用Zend Framework中的Form.它必须成为一个公司可以填写候选人详细信息的表格.

我对Zend很新,所以这就是我发布问题的原因.

这就是表单的样子(删除了一些字段以缩短代码)

<?php

class Application_Form_Validate_ContactMethodSelected extends Zend_Validate_Abstract {
const INVALID = 'invalid';

protected $_messageTemplates = array(
    self::INVALID => 'Ten minste 1 vorm van contact invullen, telefoon, mobiel of e-mail'
);

public function isValid($value, $context = array())
{
// You need to use your element names, consider making these dynamic
$checkFields = array('telefoon','mobiel','mail');
// Check if all are empty
foreach ( $checkFields as $field ) {
if (isset($context[$field]) && !empty($context[$field])) {

    if (!empty($value)) {
        // This is the element …
Run Code Online (Sandbox Code Playgroud)

zend-framework file zend-form

0
推荐指数
1
解决办法
1万
查看次数

如何使用Zend_Form_Decorator将类名属性添加到标签的父标签?

我努力了,但是我无法使装饰器像我的表格那样格式化:

<form>
    <div class="form_wrapper">
        <div class="form_label">
            <!-- {{label}} -->
        </div>
        <div class="form_element">
            <!-- {{element}} -->
        </div>
    </div> <!-- end .form_wrapper -->
    <div class="form_wrapper">
        <div class="form_label">
            <!-- {{label}} -->
        </div>
        <div class="form_element">
            <!-- {{element}} -->
        </div>
    </div> <!-- end .form_wrapper -->
</form>
Run Code Online (Sandbox Code Playgroud)

当我尝试设置课程是form_label为了我decorator:

array('Label', array('tag' => 'div', 'class' => 'form_label'))
Run Code Online (Sandbox Code Playgroud)

它始终是:

<div>
    <label class="form_label">Title</label>
</div>
Run Code Online (Sandbox Code Playgroud)

我需要将标签form_label内的类移动到父元素:标签吗?labeldiv

我怎样才能做到这一点?

zend-framework zend-form

0
推荐指数
1
解决办法
482
查看次数

形式不渲染

我正在使用zend框架,并尝试使用zend表单,MVC和OOP输出一个简单的登录表单.

我的代码如下:Controller IndexController.php

class IndexController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        $this->view->loginForm = $this->getLoginForm(); 
    }

    public function getLoginForm()
    {
        $form = new Application_Form_Login;
        return $form;
    }
}
Run Code Online (Sandbox Code Playgroud)

这是以下形式:Login.php

class Application_Form_Login extends Zend_Form
{

    public function init()
    {
        $form = new Zend_Form;

        $username = new Zend_Form_Element_Text('username');
        $username
            ->setLabel('Username')
            ->setRequired(true)
        ;

        $password = new Zend_Form_Element_Password('password');
        $password
            ->setLabel('Password')
            ->setRequired(true)
        ;

        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel('Login');

        $form->addElements(array($username, $password, $submit));

    }
}
Run Code Online (Sandbox Code Playgroud)

并且视图:index.phtml …

php oop model-view-controller zend-framework zend-form

0
推荐指数
1
解决办法
95
查看次数

ZF2表单元素描述

在ZF1表单的元素有一个setDescription是被输出作为方法<p>description here</p>鉴于.... ZF2显得那么我的问题是我怎样才能添加说明,形成元素没有这个方法?

这是我的看法:

<div>
    <?
    $form = $this->form;
    $form->prepare();
    echo $this->form()->openTag($form);

    foreach ($form->getElements() as $el) {
        ?>
        <div class="form_element">
            <?=$this->formRow($el);?>
        </div>
        <?
    }
    echo $this->partial('system/form/buttons_form_part.phtml', array('form' => $form));
    echo $this->form()->closeTag();
    ?>
</div>
Run Code Online (Sandbox Code Playgroud)

zend-form zend-form-element zend-framework2

0
推荐指数
1
解决办法
2243
查看次数

ZF2表单HTML5数字元素不起作用

这是我的表格

<?php
namespace Home\Form;

use Zend\Form\Form;

class CheckPriceForm extends Form
{

    public function __construct($name = null)
    {
        parent::__construct();

        $this->add(array(
            'name' => 'distance',
            'type' => 'Zend\Form\Element\Number',
            'options' => array(
                'label' => 'Distance',
            ),
        ));

        $this->add(array(
            'name' => 'weight',
            'type' => 'Zend\Form\Element\Number',
            'options' => array(
                'label' => 'Weight',
            ),
        ));

        $this->add(array(
            'name' => 'submit',
            'type' => 'Submit',
            'attributes' => array(
                'value' => 'Check Price',                
            ),
        ));
    }
}
Run Code Online (Sandbox Code Playgroud)

给出以下错误

/home/dinuka/workspace/free_courier/vendor/ZF2/library/Zend/I18n/Validator/Float.php:49

Zend\I18n\Validator component requires the intl PHP extension
Run Code Online (Sandbox Code Playgroud)

当我替换电子邮件号码时,它正在工作.请帮我.

html5 element zend-form zend-framework2

0
推荐指数
1
解决办法
2128
查看次数

Zf2与不同的浏览器形成日期元素问题

我有一个Zf2表单日期元素,我用这种方式,

$this->add(array(
            'type' => 'Zend\Form\Element\Date',
            'name' => 'releasedate',
            'options' => array(
                'label' => 'Release Date'
            ),
            'attributes' => array(
                'min' => '2012-01-01',
                'max' => '2020-01-01',
                'step' => '1', 
            )
        ));
Run Code Online (Sandbox Code Playgroud)

所以在chrome中我得到一个日期选择器但不是在safari或firefox中?我需要为此做任何新配置吗?

browser forms zend-form zend-framework2

0
推荐指数
1
解决办法
779
查看次数

如何将密码输入转换为DOTS而不是文本

我的应用程序中有一个登录页面,但我想知道如何将用户的密码转换为点,以便当用户输入他或她的凭据时,她可以看到她的用户名,但密码是一个溺爱的公式.似乎无法在网上找到任何zend相关链接的例子也将受到赞赏.请记住,我正在使用zend形式.在此输入图像描述

php zend-framework zend-form

0
推荐指数
2
解决办法
2895
查看次数