Re: Multiple field values in select box?

2007-08-14 Thread Geoff Ford
Try $listdata[$data['Team']['team']] = $data['Sport']['sport'] . '-' . $data['Team']['team']; This missing square bracket you put in the wrong place. Geoff On 8/14/07, Beertigger [EMAIL PROTECTED] wrote: Thanks, Geoff, I caught that one earlier, also found what I think was a missing ] to

Re: Multiple field values in select box?

2007-08-14 Thread Beertigger
Excellent! Contrary to my earlier post, a href=http://php-coding-practices.com/ cakephp-specific/how-to-put-combined-fields-into-cakephps-model- generatelist/myGenerateList/a does work across Models! Tim Koschützki has really come up with a great one here. Thanks to all who helped me out

Re: Multiple field values in select box?

2007-08-13 Thread Beertigger
Back at this after a coupla days away - thanks much for all the input. Still having trouble with something entirely too basic. Based on Geoff's last input, here's my current code: In controller: function getListData($data){ $data = $this-Model-query(SELECT

Re: Multiple field values in select box?

2007-08-13 Thread cdomigan
http://php-coding-practices.com/cakephp-specific/how-to-put-combined-fields-into-cakephps-model-generatelist/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to

Re: Multiple field values in select box?

2007-08-13 Thread Beertigger
Found this one earlier. What myGenerateList does, it does very well, much easier than using an afterFind to concat things. But, from what I can tell thus far, it has the same limitation, in that it can't combine data across two models and display it in a third. On Aug 13, 2:58 pm, cdomigan

Re: Multiple field values in select box?

2007-08-13 Thread Geoff Ford
You've got a error in the getListData function - remove the curly barce between the end of the query and $listdata = array(); Geoff On 8/14/07, Beertigger [EMAIL PROTECTED] wrote: Found this one earlier. What myGenerateList does, it does very well, much easier than using an afterFind to

Re: Multiple field values in select box?

2007-08-13 Thread Beertigger
Thanks, Geoff, I caught that one earlier, also found what I think was a missing ] to close the $listdata[$data['Team']['team'] = $data['Sport']['sport'] . '-' . $data['Team']['team']; now: $listdata[$data['Team']['team'] = $data['Sport']['sport'] . '-' . $data['Team']['team']]; Still no

Re: Multiple field values in select box?

2007-08-10 Thread Geoff Ford
function getListData($data){ $data = $this-Model-query(SELECT Model1.field1 as `Model1`,`field1` , Model1.field2 as `Model1`,`field2` , Model2.field1 as `Model2`,`field1` FROM `bars` as Model1, `barbars` as Model2, WHERE `Model2`.`barbar_id` = `Model1`.`id`); } $listdata = array();

Re: Multiple field values in select box?

2007-08-09 Thread Beertigger
Still trying to concat data from two models into a select list in a third. Thanks for the help thus far, Geoff. Taking your advice, and some input from IRC, after much trying, I'm at: In controller: function getListData($data){ $data = $this-Model-query(SELECT CONCAT(bar,

Re: Multiple field values in select box?

2007-08-08 Thread Beertigger
Form::select is 1.2 only, no? I'm using 1.1 On Aug 8, 3:05 am, Geoff Ford [EMAIL PROTECTED] wrote: Forget generateList(). Create the array yourself to pass to Form::select() using a custom query if necessary. Sometimes when you are doing something that is a little bit out of the ordinary it

Re: Multiple field values in select box?

2007-08-08 Thread Beertigger
Isn't form::select for 1.2? I'm using 1.1 on this project... On Aug 8, 3:05 am, Geoff Ford [EMAIL PROTECTED] wrote: Forget generateList(). Create the array yourself to pass to Form::select() using a custom query if necessary. Sometimes when you are doing something that is a little bit out

Re: Multiple field values in select box?

2007-08-08 Thread Geoff Ford
OK so use HtmlHelper::select() or selectTag() - I can't remember of the top of my head which one it is. My solutions is still the same - creat the array that you want to display in the listbox manually. Again not sure of the exact array format but something like $data =

Re: Multiple field values in select box?

2007-08-08 Thread Beertigger
Somehow, this seems on the right track, but I couldn't get things to work. Played around with a lot of different variations, but *something* is not quite kosher, yet. Thanks much for the guidance thus far. Should the entire $data = $this-Model-getListData(); // a function in your model that

Re: Multiple field values in select box?

2007-08-08 Thread Geoff Ford
All the code I outlined would be in the controller. You could put the loop in the getListData() function in the model if you like to keep the controller cleaner. The controller would then just be $this-set('listdata', $this-Model-getListData()); Geoff On 8/9/07, Beertigger [EMAIL PROTECTED]

Multiple model fields in generatelist, was: Multiple field values in select box?

2007-08-01 Thread Beertigger
Moving this one along a bit I've tried every which way to get this one to work, and I'm stumped. Using afterFind on info from one table works just fine; putting this in the Player model: function afterFind($results) { foreach ($results as $key = $val) {

Re: Multiple field values in select box?

2007-08-01 Thread Beertigger
Multiple model fields in generatelist... ? Moving this one along a bit I've tried every which way to get this one to work, and I'm stumped. Using afterFind on info from one table works just fine; putting this in the Player model: function afterFind($results) { foreach ($results

Re: Multiple field values in select box?

2007-08-01 Thread Beertigger
Anyone? I'm pulling my hair out here. This is something that should be basic, shouldn't it? I'll freely admit I'm an idiot, but I'm just not understanding this ; ( Thanks to anyone willing to point me in the right direction. On Aug 1, 9:38 am, Beertigger [EMAIL PROTECTED] wrote: Multiple

Re: Multiple field values in select box?

2007-07-28 Thread cauld
Not exactly a cake solution, but in the past I've created a database view an concatenated the two columns I want in the SQL (ex) concat(last_name, ', ', first_name) and then passed the view results to generateList(). Perhpas you could do the same with query() and pass those results to

Multiple field values in select box?

2007-07-27 Thread Beertigger
Is there any way to get values from multiple fields into a select box? After much searching, I've come to the conclusion I'm not going to find the answer without appealing to those far wiser than myself... Here's an old thread for reference, which discusses, w/o resolution, exactly what I'm