Hey everyone,

I've been trying to find an answer to this all day with no luck, so I
thought I'd poll the great minds on this list to see if anyone knows
what's going on here...

What I've got:  I'm working on a service request form, trying to build
a drop down selection box on the web form using data from a table
(Model) that is not part of my current Model/Controller/View.  The
data resides in the Model "App" and I'm using the Model "Request".
What I'm trying to do is grab all the values (rows) from
App.app_name.  (This table is very simple, it has two columns "app_id"
and "app_name".)

Basically I want the selectTag method to build a selection box with
the query SELECT app_name FROM apps, the problem is that cakePHP is
constructing a query like SELECT app_name FROM apps WHERE request_id =
'x'

What I've tried:  I've tried adding:

var $hasMany = array('App' => array(
 
'className'        => 'App',
 
'conditions'         => null,
 
'order'                => null,
 
'limit'                 => null,
 
'foreignKey'       => 'app_id',
 
'dependent'        => false,
 
'exclusive'         => false,
 
'finderQuery'      => ''
                                                     )
                                );

This code causes the where clause to be inserted where I do not want
it to be.

I also have this in my Results Controller file to try and assign the
data into a variable to be used in my view:

$this->set('list',$this->Request->App->getList())  <---- which calls a
function in my App controller that looks like:

function getList() {
  $this->set('return', $this->generateList(null,null,
100,'{n}.App.app_id','{n}.App.app_name');
  return $return;
}

So my first problem is how in the world do I force this to pull back
the entire contents inside the apps table (there are only four rows in
this table, so it's not a lot of data).

Then my second problem is getting a select box built with selectTag?
Currently I have this in my code:

$html->selectTag('Request/App/app_name',
$list',null,array(),null,false,false)

but of course, that's not working right now.

This post may be a bit fragmented right now, so if anyone has any
thoughts on how to sort all of this out but needs more info, please
let me know!

Thank you!

--Patrick Holt


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to