【问题标题】:how to add data-mask in zend form如何以zend形式添加数据掩码
【发布时间】:2016-08-22 10:22:10
【问题描述】:

如何将下面的html文本字段转换成zend形式,

 <div class="control-group">
                        <label class="control-label">IP</label>
                        <div class="controls">
                            <input placeholder="" data-mask="999.999.999.999" class="text login_input" type="text">
                            <span class="help-inline">192.168.110.310</span>
                        </div>

我用的是zend 1.2,我的挑战是data-mask="999.999.999.999"如何添加一个zend表单,

我给出下面的代码,但不起作用,

    $ipRange = new Zend_Form_Element_Text('ipRange');
    $ipRange->class = "text login_input";
    $ipRange->data-mask = "999.999.999.999";
    $ipRange->addValidator('Ip', array('allowipv6' => false));
    $ipRange->setDecorators(array('ViewHelper','Description'));
    $ipRange->setAttrib('required', 'required');
    $ipRange->setRequired(true);
    $this->addElement($ipRange);

【问题讨论】:

  • 您可以完全按照添加placeholder 的方式添加data-mask 属性:)

标签: zend-framework zend-form data-masking


【解决方案1】:

试试这个:

$ipRange->setAttrib('data-mask', '999.999.999.999');

【讨论】:

    猜你喜欢
    • 2011-09-02
    • 2023-02-10
    • 2018-12-23
    • 1970-01-01
    • 2023-01-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多