I have a form with (at least) the following two fields:
- country
- club
The club is a field that is generated via the ZendX_JQuery_Form_Element_AutoComplete Element, that also generates the following javascript code:
$("#club").autocomplete({"url":"\/mywebsite\/\/mycontroller\/autocomplete"});
I have a database of clubs per country. What I want is that only the clubs are returned for the (user) given country. This list should be retrieved via a remote (ajax) call. The code for that is:
public function autocompleteAction()
{
$request = $this->getRequest();
$filter = $request->getParam('q');
$country = $request->getParam('country');
$clublist = getClubListBySubstring($country, $filter);
$this->_helper->autoComplete($clublist);
}
I can probably change the above javascript-code, by-passing the generation done by ZendX_JQuery_Form_Element_AutoComplete and add an extra element to the URL that gets interpreted as parameter country .
But is there a more elegant solution? I've read something about ExtraParams, would that work, and how?