Ok, this setup will give you a post-redirect-get mechanism.
You could also forgo the requirement for the id to be passed as a
parameter, and just use the posted data[] - this would avoid the
redirect.
Some kind of validation would be good to add, too.
View:
<?php
echo $form->create('Lead', array('action' => 'filter'));
echo $form->input(...);
echo $form->end('Go');
?>
Controller:
function filter($filter_id = null) {
if (empty($filter_id) && !empty($this->data['Lead']['employee'])) {
$this->redirect(array('action' => 'filter', $this->data['Lead']
['employee']));
}
// Rest of code here
}
hth
grigri
On Jul 21, 10:20 am, james <[email protected]> wrote:
> Im having a real noob time with this!
>
> Im trying to refine the information that is represented in an index
> based on the selection from a combo box which has a list of employees.
> The user selects the employee they want, clicks go and view then gets
> refined to all records associated to that employee_id.
>
> so in my controller I have
>
> function filter($filter_id = null){
> $filterQuery = $this->Lead->find('all',
> array(
> 'conditions'=>array( 'Lead.employee_id' =>
> $filter_id)));
> $this->set->('filterQuery', $filterQuery);
>
> and my index view I have
>
> <?php echo $form->input('employee', array
> ('label' => '',
> 'type' => 'select',
> 'options' => array($employee), ));?>
> <?php echo $form->end('Go');?>
>
> Do i need to link that action to a comnpletely different view eg
> filter.ctp? How do i call the method and pass the id?
>
> Please help!
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