Cjuiautocomplete On Url With Id Parameter

I need to implement DB lookup field and am trying to make use of CJuiAutoComplete widget. I need the widget to fetch data from the following URL: www/controller/action/ID/?term=<query>. That is I need the request to come to an action handler similar to actionView, which accepts a numerical paramater ID (if it could be a string, it would be better, but I decided to start from a simplified implementation).

When I define CJuiAutoComplete in my form as the following:

$this->widget('zii.widgets.jui.CJuiAutoComplete', array(

        'source' => $this->createUrl('price/lookup/1'),...

I’ve got an error “Invalid request” in logs, with the following URL (www/price/lookup/1?term=xxx), which is correct in the sense that I want it to be like this. But Yii does not apparently like it.

If I change the form to have:

$this->widget('zii.widgets.jui.CJuiAutoComplete', array(

        'source' => $this->createUrl('price/lookup'),...

the request is handled normally by Yii (URL is www/price/lookup?term=xxx), but I do not receive the ID which I need to pass.

The question is how to setup Yii in order to accept the required URL for autocompletion? I think this is somehow related to the main configuration file, and specifically urlManager’s rules, but I don’t know what to write there to fix the problem. Currently I have standard configuration:



			'showScriptName' => false,


			  'site/page/<view:\w+>' => 'site/page',






URLs with controller/action/id are accepted. Also I do not see here any special case for URLs with “?param=value” part in the line where controller/action rule is defined, nevertheless it accepts “?param=value” in the case when I don’t provide the ID.

Could someone shed some light on this?

I found what’s the origin of the problem. The error was that the name of the action parameter was other than $id. Yii resolves params by name using reflection.