2010-07-21 95 views
0

我遇到了Zend_Form的問題,我們將不勝感激。 實際上我有一個類生成的類別作爲選項從行html創建Zend_Form元素

$categories = My_Util_Category::toHtmlSelect();//for simplicity I removed other lines 

此代碼生成

<select> 
<option > root</option> 
<option> root/children</option> 
</select> 

在另一方面,我用Zend_Form形式來編輯類別。代碼如下:

$form = My_Form_Category($data, $selectElements = array()); 

其輸出形式,文本字段,父類別選擇框和一個提交按鈕。

如何從$形式得到「選擇元素」,並與行HTML代替它「選擇」與$類別

任何幫助生成或鏈接將不勝感激。 謝謝。

回答

0

好吧,我改變了下拉列表,而不是

$categories = My_Util_Category::toHtmlSelect(); 

$categoryList = My_Util_Category::getCategoryList(); 

它返回一個數組,並通過返回數組形式的構造函數

$form = My_Form_Category($data, $categoryList); 

希望它能幫助別人。