2011-06-01 58 views
1

Zend說。我構建了一個Zend_Form類。 我注意到,如果我傳遞字符串'0',我的表單元素的方法setDescription將它視爲NULL,我無法在元素描述中回顯其值。Zend將包含「Zero」的字符串傳遞給form-element說明

//this is how I set the element description in Myform class: 
$element->setDescription('0'); 

我該如何避免這種情況?

感謝

盧卡

回答

0

這是我要做的事

abstract class Gestionale_Form_Abstract_Form extends Zend_Form 
{ 
    protected $_myParams;//params per customizzare il form in base all'action edit/new 

    public function __construct($options = null, $myParams = null) 
    { 
     $this->_myParams = $myParams; 
     parent::__construct($options); 
    } 

....

,然後例如

class Form_Contatto extends Gestionale_Form_Abstract_Form 
... 
    $clienteid->setValue($this->_myParams['data']['id']);// 
+0

Ho riformulato la domanda =)ano io sono di Roma .. non ci conosciamo ?? – luca 2011-06-01 15:58:02

1

我會嘗試要麼是puttin g周圍的空白區域,或者禁用自動轉義並在範圍或其他標記中包裝0。

+0

我的裝飾器設置:「array('Description',array('tag'=>'h2','placement'=>'append',」escape「=> false))」。你的建議沒有任何建議,感謝 – luca 2011-06-01 18:33:52