i had the same problem with years
i think its because input() with type date/datetime needs an array to
parse it before validation

my solution was to use an input (as a select box) with a manual
range(20xx-20xx) for the options array :)
then its sure as hell a string


On 21 Mrz., 04:17, lunanoko <[email protected]> wrote:
> Dear CakePHP users,
>
> I built a form which worked fine, up until I installed the CakePHP
> Tags Plugin from CakeDC. Since that plugin started working, my Form->year() 
> input returns Array, instead of an integer. Does anyone have
>
> any idea how this could happen?
>
> My form code is as follows:
>
>     echo $this->Form->create('Story', array('action' => 'add'));
>     echo $this->Form->input('title', array('label' => 'Titel:'));
>     echo $this->Form->input('body', array('label' => 'Jouw verhaal:',
> 'rows' => 15, 'cols' => 60));
>     echo $this->Form->label('', 'In welk jaar speelde dit verhaal?');
>     echo $this->Form->year('year', 1920, date('Y'), 1950);
>     echo $this->Form->input('tags');
>     echo $this->Form->input('school_id', array('value' => $school,
> 'type' => 'hidden'));
>     echo $this->Form->input('user_id', array('value' => 1, 'type' =>
> 'hidden'));
>     echo $this->Form->end('Verstuur');
>
> When I submit the form, this is the error I receive:
>
> Notice (8): Array to string conversion [CORE/cake/libs/model/
> datasources/dbo_source.php, line 749]
> Warning (512): SQL Error: 1054: Unknown column 'Array' in 'field
> list' [CORE/cake/libs/model/datasources/dbo_source.php, line 684]
> Query: INSERT INTO `stories` (`title`, `body`, `year`, `tags`,
> `school_id`, `user_id`, `modified`, `created`) VALUES ('dfgfg',
> 'fgdgdgdfg', Array, 'werk', 1, 1, '2011-03-21 04:09:01', '2011-03-21
> 04:09:01')
>
> As you can see, the value for 'year' is 'Array'... I have no idea
> where this is coming from, but the form works when I comment the line
> that creates the year input.
>
> Any help would be greatly appreciated!

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to