Re: Dropdownfeld
Hello Ivo,
Please check, if you have "connected" your Country Model to the
Controler.
You can do this via
$uses = array('Country');
Please have a look to the manual:
<http://book.cakephp.org/1.3/en/view/959/Controller-
Attributes#components-helpers-and-uses-961>
On 2 Jan., 18:30, Ivo Wolgensinger <wolgensin...@gmail.com> wrote:
> Hallo zusammen
>
> Ich wende zum ersten Mal cakephp an und habe auch bereits eine erste
> Ansicht mit Abfrage hinbekommen. Nun möchte ich in einem Formular ein
> Dropdown-Feld generieren aus einer Tabelle, die bisher nichts mit dem
> Controller zu tun hat. Die Tabelle heisst "countries" und angezeigt
> werden soll das Feld "printablename" (alphabetisch aufsteigend
> sortiert) mit value "iso2".
>
> Was ich bis jetzt herausgefunden habe ist:
>
> Im Controller soll sowas stehen wie:
> -----
> function beforeFilter() {
> // conditional ensures only actions that need the vars will
> receive them
> if (in_array($this->action, array('add', 'edit'))) {
> $this->set('countries', $this->Country->find('list'));
> }
> }
> -----
> Hiermit kann ich die Daten für die views "add" und "edit" verwenden.
>
> Aber bereits hier generiert es mit einen Fehler:
> "Call to a member function find() on a non-object in ..." -> Zeile
> startend mit $this...
>
> Leider finde ich nirgend eine ausführliche Anleitung wie ich dies
> gestalte von A bis Z.
>
> Für Hinweise bin ich Euch dankbar!
>
> Beste Grüsse
>
> Ivo
--
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home