Re: creating and auto-populating search form?

2011-09-25 Thread WebbedIT
If your field is ModelName.zipcode the following should do the trick

$this-set('zipcodes', $this-ModelName-find('list', array(
  'fields'=array('ModelName.zipcode', 'ModelName.zipcode')
)));

http://book.cakephp.org/view/1018/find

HTH, Paul

On Sep 23, 8:25 am, mivogtGermanyLU miv...@mivogt.net wrote:
 Hi there, everyone.
 First at all I want to say thanks a lot for all help given to me so
 far.
 Meanwhile my first small project has left its alpha going to early
 beta status :)

 Todays question is somewhere between automagic form helper, find() and
 real sql code ...

 I would like to add some search form in my app - i.e. customer search.
 It woukd be qziet easy just to add a set of fields for name, surename
 and zipcode - but I would like to get it a bit more comfortable (I
 hope it is).

 Is there an easy way to autopopulate dropdown-fields like zipcode
 based on the database-data of table customers/clients with cake-
 functions or will I have to use some sql to retrieve the data with
 (only once per zipcode)?

 Thanks in advance

 Michael

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


creating and auto-populating search form?

2011-09-23 Thread mivogtGermanyLU
Hi there, everyone.
First at all I want to say thanks a lot for all help given to me so
far.
Meanwhile my first small project has left its alpha going to early
beta status :)

Todays question is somewhere between automagic form helper, find() and
real sql code ...

I would like to add some search form in my app - i.e. customer search.
It woukd be qziet easy just to add a set of fields for name, surename
and zipcode - but I would like to get it a bit more comfortable (I
hope it is).

Is there an easy way to autopopulate dropdown-fields like zipcode
based on the database-data of table customers/clients with cake-
functions or will I have to use some sql to retrieve the data with
(only once per zipcode)?

Thanks in advance

Michael

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php