2012-09-28 57 views

回答

0

一些更多的信息和代碼片斷會幫助,但..

有幾個地方,這可能實現,我會去爲2最直接,最有希望,常見的。

1) 您的形式已經被定製,並很可能會住在plugins/yourPlugin/lib/form/yourForm.class.php

在這裏會有類似$this->setWidget('my_input', new sfWidgetChoice(array([...])));

有很多「選擇」小工具也可能是(學說或推進,如果他們來自數據庫)

您需要將其更改爲$this->setWidget('my_input', new sfWidgetFormInput());

2) 您的形式以前沒有被修改,是生成的表單

您將需要進入你actions.class.php(或components.class.php),並找到它說:$this->form = new yourForm();

創建一個新的形式plugins/yourPlugin/lib/form並使其擴展您的先前的表格。

class yourNewForm extends yourForm 

然後加入

public function setup() 
{ 
$this->setWidget('my_input', new sfWidgetFormInput()); 
} 

你可能必須更新驗證爲好,否則就會在「SELCT盒子」格式預期數據。

http://www.symfony-project.org/api/1_1/sfWidgetFormInput