I can't find bug in this source code? Help!
/Nothing happens when I select a client/
Thanks.
-----------------------------------
/views/elements/activity_filter.ctp
-----------------------------------
<h3 class="heading">Select Activities</h3>
<?php echo $form->create('Activity', array('type' => 'get', 'action'
=> 'select')); ?>
<?php echo $form->input('client_id', array('empty' => '--', 'class' =>
'select-refine', 'selected' => isset($this->params['named']
['client_id']) ? $this->params['named']['client_id'] : '')); ?>
<?php echo $form->input('project_id', array('class' => 'select-
refine', 'selected' => isset($this->params['named']['project_id']) ?
$this->params['named']['project_id'] : '')); ?>
<!-- ???????????? -->
<?php $options = array('url' => 'getprojects', 'update' =>
'ActivityProjectId'); ?>
<?php echo $ajax->observeField('ActivityClientId', $options); ?>
<?php echo $ajax->observeField('client_id',array
('url'=>'update_project_select','update'=>'projects'));?>
<!-- ???????????? -->
<?php echo $form->end('Search'); ?>
-----------------------------------------
/views/elements/updata_project_select.ctp
-----------------------------------------
<?php
if (!empty($options)) {
foreach ($options as $k => $v) {
echo "<option value='$k'>$v</option>";
}
}
?>
-----------------------------------
/views/activities/ajax_dropdown.ctp
-----------------------------------
<?php foreach($options AS $k=>$v) : ?>
<option value="<?php echo $k; ?>"><?php echo $v; ?></option>
<?php endforeach; ?>
-----------------------------------
activities_controller.php
-----------------------------------
class ActivitiesController extends AppController {
var $name = 'Activities';
var $helpers = array
('Html','Form','Time','Number','Ajax','Javascript');
var $components = array('Auth', 'RequestHandler');
var $paginate = array('limit' => 10,'order' => array('Activity.date
DESC'));
.
.
function getProjects() {
$this->set('options',
$this->Activity->Project->find('list',
array(
'conditions' => array(
'Project.client_id' =>
$this->data['Activity']['client_id']
),
'group' => array('Project.name')
)
)
);
$this->render('/activities/ajax_dropdown');
}
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" 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