not sure this is the best way to do this
function refreshSearchElement()
{
$this->layout = false;
// get your new param ...
$this->set('new_param', $new_param);
}
refresh_search_element.ctp:
echo $this->element('search_element_1', array('the_param', $new_param));
On Mon, Feb 9, 2009 at 11:24 PM, Corey Crawford
<[email protected]> wrote:
>
> Hello everyone,
>
> I'm new to CakePHP (like everyone else on here, it seems), and so I'm
> having trouble utilizing the ajax helper to refresh a div containing
> an element.
>
> Right now I have my default (home) controller setup to show a view
> which utilizes an element to pull in a truncated version of a search
> result.
>
> So you have:
>
> home controller (no logic here yet) -> home view -> search element1
>
> I'm trying to figure out a way to refresh the div the element is
> within by calling the element with a different parameter (to apply a
> filter, for example). In my home controller I have a
> refreshSearchElement() method that tries to return the output of the
> element, which my ajax observeField calls when a drop down menu is
> changed.
>
> Apparently that doesn't work, because I get 'Call to undefined method
> HomeController::element()' when I call $this->element
> ('search_element_1'). I guess that only works in views?
>
> Is there a way to pull in an element's contents inside a Controller
> (and preferably utilize any caching)? Or can anyone recommend
> different method to approach this?
>
> Thanks!
>
> --
> Corey Crawford
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---