Tuesday, April 5, 2011

Sort the content output in an edit/add page for belongsTo

Hi Guys,

Can't wait until I can throw away my newbie card, but here it is
again. Something which is probably simply but looking through the cook
book and searching has pulled up nothing.

I've got a model called resources, part of which belongsTo
subcategories. In add/edit views I've used the following echo $this-
>Form->input('subcategory_id'); and it does exactly what I want
(almost) output a select with options of all the possible
subcategories.

However, the client has asked that this output (the subcategories) be
output alphabetically in this select, and I can't figure out how to do
it! I first looked for something in the helper, turned up blank, then
figured perhaps I need to add something to the two methods (add/edit)
in the controller. But what?

Can anybody shed some light, point me in the right direction please?

Thanks, Adam.

--
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


Real Estate