Skip to content

Delete item in "view" view #1512

ffarandole opened this Issue Oct 1, 2012 · 5 comments

2 participants



Given a GII-generated model "Post" and YII-CRUD actions.
Deleting Post item from "View Posts" view doesn't work : Javascript error.

Error description:

Firebug displays : "TypeError: jQuery.yii is undefined". The corresponding code lines are :

// Here $.yii and jQuery.yii exist
jQuery(function($) {
            if(confirm('Are you sure you want to delete this item?')) {
                    // Here $.yii exists whereas and jQuery.yii does not
                    return false;
            else return false;

One solution would be typing $.yii.submitForm() instead of. But is it reliable ?


The error occurs with Firefox 15.0.1, not with Chrome. My OS is Win 7 32 bits. Someone with Firefox 15.0.1 and Windows tried it too, with no error.
The problem must then be client-side.

@mdomba mdomba was assigned Oct 2, 2012
Yii Software LLC member
mdomba commented Oct 3, 2012

Please post your view code.


Delete link is generated with standard layout column2 thanks to this in controller:

public $layout='//layouts/column2';

and configured thanks to this in view:

array('label'=>'Delete', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->id),'confirm'=>'Are you sure you want to delete this item?')),

Yii Software LLC member
mdomba commented Oct 4, 2012

Unfortunately I cannot replicate this and have no idea what could be the problem.

Did you made any change in the code generated by Gii ?
Do you use a custom jQuery?
Do you use scriptMap?
Did you add some custom JS/jQuery plugins or code?


Inspired by your message, I reinstalled Firefox, deleting every user preferences. The issue does not occur any longer.

I suppose this was due to Greasemonkey add-on but I can't confirm it. Two options:

  • Greasemonkey itself since my version was out of date.
  • A Greasemonkey user script running ; creating conflict. (Thinking twice about it, it may had included jQuery...)

Thank you for your time and consideration.

Yii Software LLC member
mdomba commented Oct 4, 2012

No problem, so if it's working now this issue can be closed?

@ffarandole ffarandole closed this Oct 7, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.