Re: Filter automagic drop down combo box

2010-03-16 Thread Travis
Thanks!

Again, sort of off topic, but if anyone knows of a good cakephp book,
there are a few on amazon

http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=cakephp&x=0&y=0

but they have mixed reviews, any opinions?

Thanks again,
Travis

On Mar 15, 6:53 pm, "Alan Asher"  wrote:
> Change your
> $this->set('fields',$this->Event->Fields->findAllBySeason('2010'));
>
> To say
> $this->set('fields',$this->Event->Fields->find('list',array('conditions'=>a­r
> ray('season'=>'2010';
>
> Basically findby is a normal sql query and find('list') is a special query
> that returns an array of key value pairs of id and title
>
> Alan
>
>
>
> -Original Message-----
> From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
>
> Of Travis
> Sent: Monday, March 15, 2010 11:58 AM
> To: CakePHP
> Subject: Filter automagic drop down combo box
>
> I am working on a farm management app, and have a quick combo box
> automagic question.
>
> Because fields (a grouping of a crop/acres/harvest yields) vary
> greatly from year to year, I have decided its best to create a new set
> of all fields each year.
>
> The user needs to be able to create events for a field, when the user
> creates an event such as a chemical (fertilizer/pesticide/etc) event,
> they select the field that it should be added to in a automagic combo
> box. I need to filter the drop down box so that it only shows the
> fields from the current season. below is my controller code:
>
> function addChemical()
>         {
>             if(!empty($this->data))
>             {
>                 if($this->Event->save($this->data))
>                 {
>                     $this->Session->setFlash('Event Created');
>                     $this->redirect(array('action'=>'chemical'));
>                 }
>             }
>             $this->set('fields',$this->Event->Fields-
> >findAllBySeason('2010'));
>             $this->set('chemicalChemicals',$this->Event->Chemicals-
> >find('list'));
>             $this->set('chemicalMeasurementsRates',$this->Event-
> >Measurements->find('list'));
>             $this->set('chemicalMeasurementsPers',$this->Event-
> >Measurements2->find('list'));
>             $this->set('chemicalImplements',$this->Event->Implements-
> >find('list'));
>             $this->set('fieldFilter',$this->Session-
> >read('fieldFilter'));
>         }
>
> It seems to only return the fields in season 2010, but instead of just
> giving me the field name like it did when I put in find('list') it
> populates every field into the drop down which is definitely not what
> I want.
>
> *Note, for now I am using a hard coded date for testing.
>
> Also, I was wondering if anyone knew of a good cakephp book?
>
> Thanks
> Travis Marble
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> with their CakePHP related questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


RE: Filter automagic drop down combo box

2010-03-15 Thread Alan Asher
Change your 
$this->set('fields',$this->Event->Fields->findAllBySeason('2010'));

To say 
$this->set('fields',$this->Event->Fields->find('list',array('conditions'=>ar
ray('season'=>'2010';

Basically findby is a normal sql query and find('list') is a special query
that returns an array of key value pairs of id and title

Alan

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Travis
Sent: Monday, March 15, 2010 11:58 AM
To: CakePHP
Subject: Filter automagic drop down combo box

I am working on a farm management app, and have a quick combo box
automagic question.

Because fields (a grouping of a crop/acres/harvest yields) vary
greatly from year to year, I have decided its best to create a new set
of all fields each year.

The user needs to be able to create events for a field, when the user
creates an event such as a chemical (fertilizer/pesticide/etc) event,
they select the field that it should be added to in a automagic combo
box. I need to filter the drop down box so that it only shows the
fields from the current season. below is my controller code:

function addChemical()
{
if(!empty($this->data))
{
if($this->Event->save($this->data))
{
$this->Session->setFlash('Event Created');
$this->redirect(array('action'=>'chemical'));
}
}
$this->set('fields',$this->Event->Fields-
>findAllBySeason('2010'));
$this->set('chemicalChemicals',$this->Event->Chemicals-
>find('list'));
$this->set('chemicalMeasurementsRates',$this->Event-
>Measurements->find('list'));
$this->set('chemicalMeasurementsPers',$this->Event-
>Measurements2->find('list'));
$this->set('chemicalImplements',$this->Event->Implements-
>find('list'));
$this->set('fieldFilter',$this->Session-
>read('fieldFilter'));
}

It seems to only return the fields in season 2010, but instead of just
giving me the field name like it did when I put in find('list') it
populates every field into the drop down which is definitely not what
I want.

*Note, for now I am using a hard coded date for testing.

Also, I was wondering if anyone knew of a good cakephp book?

Thanks
Travis Marble

Check out the new CakePHP Questions site http://cakeqs.org and help others
with their CakePHP related questions.

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 For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Filter automagic drop down combo box

2010-03-15 Thread Travis
I am working on a farm management app, and have a quick combo box
automagic question.

Because fields (a grouping of a crop/acres/harvest yields) vary
greatly from year to year, I have decided its best to create a new set
of all fields each year.

The user needs to be able to create events for a field, when the user
creates an event such as a chemical (fertilizer/pesticide/etc) event,
they select the field that it should be added to in a automagic combo
box. I need to filter the drop down box so that it only shows the
fields from the current season. below is my controller code:

function addChemical()
{
if(!empty($this->data))
{
if($this->Event->save($this->data))
{
$this->Session->setFlash('Event Created');
$this->redirect(array('action'=>'chemical'));
}
}
$this->set('fields',$this->Event->Fields-
>findAllBySeason('2010'));
$this->set('chemicalChemicals',$this->Event->Chemicals-
>find('list'));
$this->set('chemicalMeasurementsRates',$this->Event-
>Measurements->find('list'));
$this->set('chemicalMeasurementsPers',$this->Event-
>Measurements2->find('list'));
$this->set('chemicalImplements',$this->Event->Implements-
>find('list'));
$this->set('fieldFilter',$this->Session-
>read('fieldFilter'));
}

It seems to only return the fields in season 2010, but instead of just
giving me the field name like it did when I put in find('list') it
populates every field into the drop down which is definitely not what
I want.

*Note, for now I am using a hard coded date for testing.

Also, I was wondering if anyone knew of a good cakephp book?

Thanks
Travis Marble

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en