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:

About CDB 361 Articles
Self-Employed Software Developer, Spark, Property Management, Hobby Forestry, Ex-Teacher, Engineering - Wood, Metal, Electrics & Computers. Outdoors - Walk, Cycle, Kitesurf,

Be the first to comment

Leave a Reply

Your email address will not be published.


*


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