0

我想添加没有标签的输入,我想要这样的 HTML 代码

<label>sender</label>
<input type="text" name="senderNo"/>
<input type="text" name="senderName"/>

我做装饰​</p>

  $mailSenderNo = new Zend_Form_Element_Text('mailSenderNo');
  $mailSenderNo->setLabel("الجهة المرسلة")
            ->setDecorators(
                    $this->setInlineDecorator("smallNoText")
    );
  $mailSenderName = new Zend_Form_Element_Text('mailSenderName');
  $mailSenderName->setDecorators(
                    $this->setInlineDecorator("largeText")
  );

这是装饰器

function setInlineDecorator($className = null) {

    $inlineDecorator = null;
    if ($className == null) {
        $inlineDecorator = array(
            'ViewHelper',
            'Errors',
            array(array('data' => 'HtmlTag'), array('tag' => 'span')),
            array('Label', array('tag' => 'span', 'class' => 'elementTitle'))
        );
    } else {

        $inlineDecorator = array(
            'ViewHelper',
            'Errors',
            array(array('data' => 'HtmlTag'), array('tag' => 'span','class' => $className)),
            array('Label', array('tag' => 'span' ))
        );
    }
    return $inlineDecorator;
}

这个结果

<span id="mailSenderNo-label">
  <label class="optional" for="mailSenderNo">الجهة المرسلة</label>
</span>
<span class="smallNoText">
    <input id="mailSenderNo" type="text" value="" name="mailSenderNo">
</span>
<span id="mailSenderName-label">&nbsp;</span>  ?????  I don't what to have this span
<span class="largeText">
   <input id="mailSenderName" type="text" value="" name="mailSenderName">
</span>

这个跨度

<span id="mailSenderName-label">&nbsp;</span>  

是用于 mailSenderName 输入的标签,我怎样才能删除这个跨度????

4

1 回答 1

3

添加这一行: -

$mailSenderName->removeDecorator('Label');

这只会从该元素中删除标签。

于 2012-06-21T09:12:23.787 回答