|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
setting displayField to a custom fieldHi fellow CakePHP enthusiasts. I have a problem which I'm sure is probably pretty simple but I am not sure how to do it. I have a standard Users table with first name, last name, etc. What I would like to do is set the displayField of the Users model to a concatenation of first_name . " " . last_name Now I am thinking that I can accomplish this by creating a custom field in my model which concatenates these two fields, and set the displayField to this, but I am not sure how to go about creating the custom field. Thanks in advance for any help! I really appreciate it. David Roda --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@... To unsubscribe from this group, send email to cake-php+unsubscribe@... For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: setting displayField to a custom fieldthere are behaviours for that (multiple_display_field) or you do it manually by using "beforeFind()" in your model On 5 Nov., 23:22, Dave <davidcr...@...> wrote: > Hi fellow CakePHP enthusiasts. > > I have a problem which I'm sure is probably pretty simple but I am not > sure how to do it. > > I have a standard Users table with first name, last name, etc. > > What I would like to do is set the displayField of the Users model to > a concatenation of first_name . " " . last_name > > Now I am thinking that I can accomplish this by creating a custom > field in my model which concatenates these two fields, and set the > displayField to this, but I am not sure how to go about creating the > custom field. > > Thanks in advance for any help! I really appreciate it. > > David Roda You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@... To unsubscribe from this group, send email to cake-php+unsubscribe@... For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: setting displayField to a custom fieldThanks euromark.
what type of logic would I be performing in beforeFind() to accomplish this goal? On Fri, Nov 6, 2009 at 6:01 AM, euromark (munich) <dereuromark@...> wrote:
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@... To unsubscribe from this group, send email to cake-php+unsubscribe@... For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: setting displayField to a custom fieldShouldn't be in afterFind? When data grabbed from DB, You iterate throug them and add do sth like this $this->data[$n]['User']['whole_name'] = $this->data[$n]['User'] ['name'] . " " . $this->data[$n]['User']['last_name']; right? On Nov 6, 7:12 pm, David Roda <davidcr...@...> wrote: > Thanks euromark. > > what type of logic would I be performing in beforeFind() to accomplish this > goal? > > On Fri, Nov 6, 2009 at 6:01 AM, euromark (munich) < > > dereurom...@...> wrote: > > > there are behaviours for that (multiple_display_field) > > or you do it manually by using "beforeFind()" in your model > > > On 5 Nov., 23:22, Dave <davidcr...@...> wrote: > > > Hi fellow CakePHP enthusiasts. > > > > I have a problem which I'm sure is probably pretty simple but I am not > > > sure how to do it. > > > > I have a standard Users table with first name, last name, etc. > > > > What I would like to do is set the displayField of the Users model to > > > a concatenation of first_name . " " . last_name > > > > Now I am thinking that I can accomplish this by creating a custom > > > field in my model which concatenates these two fields, and set the > > > displayField to this, but I am not sure how to go about creating the > > > custom field. > > > > Thanks in advance for any help! I really appreciate it. > > > > David Roda You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@... To unsubscribe from this group, send email to cake-php+unsubscribe@... For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~--- |
| Free embeddable forum powered by Nabble | Forum Help |