Re: html attributes on 'year' form helper
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 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 wrote: > > Despite having read over the relevant sections of the book I can't seem to > > get the 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... > > > > > > Category > > > > Category1 > > Category2 > > > > > > > > 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… > > > > > > 2012 > > 2011 > > 2010 > > …etc… > > 1990 > > > > > > 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… > > > > > id="published" div="input select"> > > 2012 > > 2011 > > 2010 > > …etc… > > 1990 > > > > > > 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.
Re: html attributes on 'year' form helper
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 > > wrote: > > Despite having read over the relevant sections of the book I can't seem > to get the 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... > > > > > > Category > > > > Category1 > > Category2 > > > > > > > > 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… > > > > > > 2012 > > 2011 > > 2010 > > …etc… > > 1990 > > > > > > 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… > > > > id="published" div="input select"> > > 2012 > > 2011 > > 2010 > > …etc… > > 1990 > > > > > > 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.
Re: html attributes on 'year' form helper
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 wrote: > Despite having read over the relevant sections of the book I can't seem to > get the 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... > > > Category > > Category1 > Category2 > > > > 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… > > > 2012 > 2011 > 2010 > …etc… > 1990 > > > 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… > > div="input select"> > 2012 > 2011 > 2010 > …etc… > 1990 > > > 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-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.
html attributes on 'year' form helper
Despite having read over the relevant sections of the book I can't seem to get the 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... Category Category1 Category2 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… 2012 2011 2010 …etc… 1990 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… 2012 2011 2010 …etc… 1990 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-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.