Thanks for the confirmation/suggestions I've used...
echo $this->Form->input( 'published', array( 'type' => 'date', 'dateFormat' => 'Y', 'minYear' => date('Y'), 'maxYear' => date('Y') - 20, ) ); Cheers again for the tips Paul On 4 Oct 2012, at 10:08, euromark <dereurom...@gmail.com> wrote: > use Form->input() and type=>date + dateFormat=>Y > > > Am Donnerstag, 4. Oktober 2012 09:51:31 UTC+2 schrieb Mike Griffin: > It seems that the year helper doesn't support html attributes. Looking > at the API (http://api.cakephp.org/class/form-helper#method-FormHelperyear), > it only accepts a small subset of the options that other form helper > functions support. I guess this is because it returns a SELECT element > and they normally join in with other elements. > > It looks like you will have to manually add the div and label around > the year helper. > > Mike. > > On Thu, Oct 4, 2012 at 12:06 AM, Paul Willis <paul....@me.com> wrote: > > Despite having read over the relevant sections of the book I can't seem to > > get the <div> stuff working properly with $this->Form->year form helper in > > 2.2.2 > > > > Any other standard input select like... > > > > echo $this->Form->input( > > 'category', array( > > 'type' => 'select', > > 'options' => $category, > > ) > > ); > > > > > > Produces HTML like this... > > > > <div class="input select"> > > <label for="ReportCategory">Category</label> > > <select name="data[Report][category]" id="ReportCategory"> > > <option value="1">Category1</option> > > <option value="2">Category2</option> > > </select> > > </div> > > > > I want to do the same with a 'year' select but the standard tag... > > > > echo $this->Form->year( > > 'published', 1990, date('Y'), array( > > 'empty' => false, > > ) > > ); > > > > …produces HTML without a label or div… > > > > <select name="data[Report][published][year]" id="ReportPublishedYear"> > > <option value="2012">2012</option> > > <option value="2011">2011</option> > > <option value="2010">2010</option> > > …etc… > > <option value="1990">1990</option> > > </select> > > > > I've tried (along with other variations)... > > > > echo $this->Form->year( > > 'published', 1990, date('Y'), array( > > 'empty' => false, > > 'label' => 'Published', > > 'div' => array( > > 'class' => 'input select', > > 'id' => 'published', > > ) > > ) > > ); > > > > > > But I get a weird result… > > > > <select name="data[Report][published][year]" label="Published" > > id="published" div="input select"> > > <option value="2012">2012</option> > > <option value="2011">2011</option> > > <option value="2010">2010</option> > > …etc… > > <option value="1990">1990</option> > > </select> > > > > I'm assuming I'm just getting the syntax messed up but can the 'year' form > > helper accept html attributes? Anyone see what I'm doing wrong here? > > > > Cheers > > > > Paul > > > > -- > > Like Us on FacekBook 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 post to this group, send email to cake...@googlegroups.com. > > To unsubscribe from this group, send email to > > cake-php+u...@googlegroups.com. > > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > > > > > -- > Like Us on FacekBook 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 post to this group, send email to cake-php@googlegroups.com. > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > -- Like Us on FacekBook 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.