2011-06-01 6 views
1

Zend talk。私はZend_Formクラスを作成しました。 文字列 '0'を渡すと、form-elementのメソッドsetDescriptionがNULLとみなされ、要素の説明にその値をエコーアウトできないことに気付きました。"Zero"を含むZend文字列をフォーム要素に渡す説明

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

どうすればよいですか?

おかげ

ルカ

答えて

1

http://php.net/manual/en/function.empty.phpによると、phpは '0'を空として認識します。

説明デコレータのrender()関数は、説明が空であるかどうかを確認します()。現在、「0」だけを表示する方法はありません。それが変更されるまで

私はhttp://framework.zend.com/issues

でバグレポートを提出することをお勧めしたい、あなたの最善の策は、Zendの1を拡張し、動作を変更し、独自の説明デコレータを作成することです。

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 =)anche io sono di Roma .. non ci conosciamo ?? – luca

1

のために私が試してみましたいずれかのputtinいくつかのスペースを空白にしたり、自動エスケープを無効にしたり、スパンやその他のタグに0をラップしたりすることができます。

+0

私のデコレータ設定: "array( 'Description'、array( 'tag' => 'h2'、 'placement' => 'append'、" escape "=> false))"あなたの提案のどれも働いていません。 – luca

関連する問題