what is the zend dojo form combo select auto fill function syntax?
I am using zend dojo form and would like to fill the comboselect options from year 1911 to 2011. I looked up this function for auto fill in the php manual but it does not work within ZF dojo form. I get this error message
Parse error: syntax error, unexpected '(', expecting ',' or ';' in Signup.php on line 13
//options declaration
protected $_yearOptions = array_fill(
1911,101,'year');
//adding combo element
$this->addElement(
'ComboBox',
'comboyr',
array(
'label' =>'Birthyear',
'value' =>'',
'autocomplete' => false,
'multioptions' => $this->_yearOptions,
)
);
开发者_如何学Python
Line 13 in your Signup.php file must be the protected $_yearOptions property. You cannot use functions when setting properties in classes. You must do something like this:
protected $_yearOptions = array();
protected function _getYearOptions () {
if ( empty($this->_yearOptions) ) { $this->_yearOptions = array_fill(1911,101,'year'); }
return $this->_yearOptions;
}
and then in your addElement you'll have this line instead
'multioptions' => $this->_getYearOptions(),
You may also use something different then array_fill. I don't think the result is what you are looking for.
精彩评论