Thanks. Now I'm getting the dropdown without error. But the dropdown
displays the ID field instead of
categoryname.
Also how do i make the selected categoryid to be stored in the events
table when i click add button
Please help
On Apr 4, 1:38 am, John Andersen <j.andersen...@gmail.com> wrote:
> In your EventCategory model, you have to specify that the default
> display name is not "name" but is "categoryname".
> Seehttp://book.cakephp.org/view/71/Model-Attributes#displayField-438
> for information on the models attribute "displayName"
>
> [code]
> var $displayName = 'categoryname';
> [/code]
>
> Then the find('list') will be able to use the correct table column!
>
> Enjoy,
> John
>
> On Apr 4, 1:10 am, mdb <meena.d...@gmail.com> wrote:
>
>
>
> > Hello
>
> > Thanks for the reply. But i'm very new to php, so let me go one step
> > at a time.
>
> > HABTM in my understanding is to create cross reference tables. (If i'm
> > not right, please correct me)
>
> > But my case is as follows:
>
> > Events is a master table where eventcategoryid is a foreign key
> > column (which comes from Eventcategory master).
>
> > First i want to make thedropdowndisplay workable properly.
>
> >dropdownis displayed, but for each record there are 3 records in the
> > drop down (1. label, 2. category name and 3. category id) whereas it
> > should be just categoryname as text and id as value.
>
> > I tried
> > $this->set('eventcategories', $this->Event->EventCategory-
>
> > >find('list')); (instead of find('all') which works without error.)
>
> > but if i use 'list' it throws following error:
> > SQL Error: 1064: You have an error in your SQL syntax; check the
> > manual that corresponds to your MySQL server version for the right
> > syntax to use near 'FROM `event_categories` AS `EventCategory` WHERE
> > 1 = 1' at line 1 [CORE\cake\libs\model\datasources\dbo_source.php,
> > line 666]
>
> > Query: SELECT `EventCategory`.`id`, EventCategory. FROM
> > `event_categories` AS `EventCategory` WHERE 1 = 1
>
> > its missing eventcategory.categoryname, but i donno y its happening..
>
> > Thanks in advance- Hide quoted text -
>
> - Show quoted text -
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
To unsubscribe, reply using "remove me" as the subject.
No comments:
Post a Comment