I have created a registration form with a year input (example below) which is returning an array.
$this->Form->year('graduation', 1960, date('Y'));
The error I am receiving is as follows:
Notice (8): Array to string conversion [CORE/cake/libs/model/datasources/dbo_source.php, line 749]
Code | Context
implode - [internal], line ??
DboSource::create() - CORE/cake/libs/model/datasources/dbo_source.php, line 749
Model::save() - CORE/cake/libs/model/model.php, line 1342
UsersController::register() - APP/controllers/users_controller.php, line 38
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 204
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 171
[main] - APP/webroot/index.php, line 83
Warning (512): SQL Error: 1054: Unknown column 'Array' in 'field list' [CORE/cake/libs/model/datasources/dbo_source.php, line 684]
I would appreciate anyone pointing me in the right direction (an example would be just spot on)
Many thanks in advance!
So I made some changes based on Ross' comment which no longer throws and error:
echo $this->Form->input('graduation', array('label' => 'Year of Graduation:',
'type' => 'date',
'dateFormat' => 'Y',
'empty' => true,
'minYear' => 1960, // start year
'maxYear' => date('Y') // current
)
);
Issue now is that even when selecting a year, the value in the database is being stored as null
something like this should do what you're after:
echo $this->Form->input('graduation', array('dateFormat' => 'Y',
'minYear' => 1960, // start year
'maxYear' => date('Y') // current
)
);