Multi Field Dropdown in Cakephp.

You get the picture – your database stores Firstname and Surname but you want Full Name to appear in a drop down.  The hardest part for me was finding the solution because nothing seemed to list it appropriately under Google.

Eventually I found a simple solution using virtual fields and here it is.

In your model, my example uses Student, put the following:

Now in your controller create the data array with the following:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.