Thanks Joshua.  I didn't realise the two versions where so different.

I've swicthed back to the htmltag form, and can get my select box to
display but not correctly.  it just gets filled with .$user.

Heres the code:

<?php echo $html->selectTag('users', array(' . $user . ' => ' .$user .
'), null, array(), array(), true, false); ?>

If I change array(' . $user . ' => ' .$user . ') to $user the select
box gets populated with the correct number of users but not the
values, just "array".  So I'm assuming I'm not applying the index of
the array correctly, how can I do this, there isn't an example in the
api.

On Jun 4, 2:48 pm, Joshua Benner <[EMAIL PROTECTED]> wrote:
> Oh, my instructions were for Cake 1.2, as I've not really used 1.1.  For
> 1.1 information on helpers, consult the manual and api.
>
> http://manual.cakephp.orghttp://api.cakephp.org
>
> [EMAIL PROTECTED] wrote:
> > Thanks :)
>
> > I've altered my controller to use set in my index() function:
>
> > <?php
> > class DataPointsController extends AppController
> > {
> >   var $name = 'DataPoints';
> >   var $helpers = array('form');
>
> >   function index()
> >   {
> >     $this->set('datapoints', $this->DataPoint->findAll());
> >     $sql = 'SELECT name FROM SOLDB.com_projects';
> >    $this->set('user', $this->DataPoint->query($sql));
> >   }
>
> > So I think my index.thtml file is getting the array but I'm getting a
> > new problem related to my select.
>
> > Fatal error: Call to undefined method FormHelper::select() in /Library/
> > WebServer/Documents/cake/app/views/data_points/index.thtml on line 3
>
> > Heres my index.thtml code
>
> > <h1>Data Points</h1>
> > <?php $form->select('users', $user, null, $user, 'User. . .'); ?>
>
> > I guess I'm setting the attributes wrong, could someone explain them
> > to me, the api confussed me.  Thank you
>
> > On Jun 4, 1:52 pm, Joshua Benner <[EMAIL PROTECTED]> wrote:
>
> >> First, I would recommend using the CakePHP Manua 
> >> (http://manual.cakephp.org).
>
> >> Passing data to a view is accomplished in the controller via:
>
> >> $this->set('varName', $value);
>
> >> A variable with the name specified in the first argument is then
> >> available in the view.
>
> >> [EMAIL PROTECTED] wrote:
>
> >>> Hey
>
> >>> I'm new to cakePHP and I'm going round in circles trying to create a
> >>> multi select box in my view.
>
> >>> I have a controller with a function users().  The function will return
> >>> the SQL query result that I want to populate my select box.
>
> >>> <?php
> >>> class DataPointsController extends AppController
> >>> {
> >>>   var $name = 'DataPoints';
>
> >>>   function index()
> >>>   {
> >>>     $this->set('datapoints', $this->DataPoint->findAll());
> >>>   }
>
> >>>  function view($id = null)
> >>>  {
> >>>    $this->DataPoint->id = $id;
> >>>    $this->set('datapoints', $this->DataPoint->read());
> >>>  }
>
> >>>  function users()
> >>>  {
> >>>    $sql = 'SELECT name FROM SOLDB.com_projects';
> >>>    $result = $this->DataPoint->query($sql);
> >>>    return $result;
> >>>  }
> >>> }
> >>> ?>
>
> >>> How do I use this function in my view file, index.thtml?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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