Will was referring to the data type, not the input type.  Cake handles all 
kinds of data types that are not also input types (decimal, float, etc.). 
 The benefit of Cake is that it has some smarts about creating inputs based 
on the data types in your model, but with the YEAR data type, which I admit 
is a little obscure, bake does indeed translate it into a TEXT data type, 
which the view then renders correctly as an input type=textarea.  The 
problem is in the model: I haven't dug into the bake code to see how it 
handles data types, but I suspect any data type it doesn't have a 
translation for it just goes to the biggest most gigantic catchall datatype 
that makes sense, which is TEXT.
I had the same problem in an insurance form that needed just a year in a 
field.  The year type in MySQL seemed to make sense, but then after the 
behavior that Will and I experienced, I decided to use INT(4), and set 
ranges.  
BTW, another limit to the YEAR data type: to keep the type small (1 byte), 
it's limited to a range of 255 years, which MySQL decided should start at 
1901 and end in 2155 - you have no say in the range, you lowly designer of 
your own database.

On Sunday, August 25, 2013 10:32:48 AM UTC-7, Vanja Dizdarević wrote:
>
> You should resolve that by using a proper form element in your views. Year 
> is not a recognized input type
>
>     <?php
>         $options = array();
>         $from = 1990;
>         $to = 2030;
>         for ($i = $from; $i <= $to; $i++) {
>           $options[(string)$i] = (string)$i;
>         }
>     ?>
>     <?php echo $this->Form->input('year', array( 'type' => 'select', 
> 'options' => $options)); ?>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Reply via email to