Strange behaviour of URL generator / normalizer in CRUD's menu.

Hi there,

For my model manipulation I’ve used default set of controller+views generated with Gii and the only thing I changed was to move this set into module (or a submodule called “offers” of main module called “admin”, to be precisely) and some strings changes. Nothing else.

Therefore code generated by Gii for menu of particular view is left untouched, like this:



    	array('label'=>'List', 'url'=>array('index')),

    	array('label'=>'New', 'url'=>array('create')),

    	array('label'=>'View', 'url'=>array('view', 'id'=>$model->id)),




            	'url'=>'#', 'linkOptions'=>array


                    	'submit'=>array('delete', 'id'=>$model->id),

                    	'confirm'=>'Pretty sure, you want to delete item of ID = '.$model->id.'?',

                    	'style'=>'color: red',




Today I noticed that a very strange URLs are being generated for my view and delete operations. Even if both has the same construction and are as easy as can be (module/controller/view and model’s ID) I’m getting no ID at all in first example and a hash (#) sign in place of ID for second one. For view it is:


And for delete:


I think, I don’t have to mention that both are not working, resulting in “Your request is invalid” error (as no valid ID is provided to action).

Got no idea, what is causing this situation and how to fix it. Will appreciate any help here. Thank you in advance.

as for the 2nd case (delete), its normal the # in it since its an ajax link, but the “.html” shouldn’t be there

as for the 1st, please show the url rules so we can have a better idea of what might be the problem

I don’t see, how urlManager settings could affect this as: I haven’t changed them a bit, since initial creation of website, because I have no bloody idea, how this works (I’m a total ignorant on regular expressions)! :] I would rather look for a source of this problem in a fact that this is module inside module inside core application.

Here you go:













Please report this as an issue:

ajax link should not contain "urlSuffix"

as for the other problem, be sure that "$model->id" is set

also try to change your rules for the following





                //since your urlFormat is path theres no need for the next line



Its better to change the urlFormat to get and keep the 3rd line of the rules for a better looking

instead of something/view.html/var/1

it will create using get parameters like



I do want addresses like you show in second example (with ?var=1), and since this line is not necessary for this purpose, I’ll remove it. Thanks for reporting this, and as I can see I’m a really urlManager newbie! :]