What Im trying to do is list some events as radio buttons.  When one
of the buttons is clicked I wanted it to populate three textareas with
the data from that event record.  ie: when clicking on wedding the
Event.name, Event.description, Event.information would be populated
into the three textareas.

The problem Im having is how to use the $form helper to get it to
work.  The following are what I've tried

// Option #1
//----------------------------------------------------------------
// controllers/events_controller.php
//----------------------------------------------------------------
$events = $this->Event->find('list');
                $this->set(compact('events'));

//----------------------------------------------------------------
// views/events/create_event.ctp
//----------------------------------------------------------------
echo $form->input('Event', array(
                        'div' => true,
                        'label' => true,
                        'type' => 'radio',
                        'options' => $events,
                        'onClick' => '$("EventName").value="aklsdjflkj"'
                ));

problem with #1 is that I need to loop to access the correct
Event.name, Event.description, Event.information for the onClick
event.  Right now with the find set to 'list', I don't have access to
that.

If I use the find query from step two here, I wouldn't know how to
access the correct Event.name, Event.description, Event.information
without being in a loop.  Plus the label says array rather than the
appropriate Event.name.

// Option #2
//----------------------------------------------------------------
// controllers/events_controller.php
//----------------------------------------------------------------
$events = $this->Event->find('all',
                        array(
                                "conditions" => array(
                                        "Event.template" => 1
                                )
                        )
                );
                $this->set(compact('events'));
//----------------------------------------------------------------
// views/events/create_event.ctp
//----------------------------------------------------------------
                foreach($events as $event)
                {
                        echo $form->input('Event.name', array(
                        'div' => true,
                        'label' => true,
                        'type' => 'radio',
                        'options' => $event["Event"]["name"],
                        'value' => $event["Event"]["id"]
                ));

                }

// Problem with #2 is that when I put this in a loop, everything gets
messed up with the ids and the names of the inputs.  Plus they are all
in there own div rather than being together.


Im pretty new at cake, but have been programming php for many years.
Any help is greatly appreciated.

Thanks so much,
Nick
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to