2012-07-25 66 views
0

嗨,我僅僅指剛知道你是怎麼把默認驗證:inArrayValidator關在形式上INI文件,我可以在我的控制器將其關閉,像這樣:關閉的Zend inArrayValidator形式.ini文件

$oForm->getElement("sitename")->setRegisterInArrayValidator(false); 

我希望能夠做到這一點在我的.ini以不弄亂我的控制器:

我曾嘗試以下:

elements.0.type = "select" 
elements.0.name = "sitename" 
elements.0.options.label = "Site name" 
elements.0.options.validators.inarrayvalidator = false 

但是,這並不工作,我得到以下錯誤:

Plugin by name '' was not found in the registry; used paths:\nZend_Validate_: Zend\/Validate\/ 

任何想法?

感謝

回答

1

在您的INI文件,你應該引用registerInArrayValidator而不是inArrayValidator因爲Zend_Form實際屬性被稱爲registerInArrayValidator

以下配置工作:

[elements] 

sitename.type = "select" 
sitename.name = "sitename" 
sitename.options.label = "Site name" 
sitename.options.registerInArrayValidator = false 
sitename.options.multiOptions[] = "Hello" 
sitename.options.multiOptions[] = "There"