Unable To Delete A Record With Yii Crud


(developer!) #1

Hi Experts,

I have generated crud using gii and when i’m trying to delete a record its not happening… anyone any idea pls…

this is the delete menu code generated by yii’s gii


array('label'=>'Delete Record', 'url'=>'#', 

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

'confirm'=>'Are you sure you want to delete this item?')),

Many Thanks


(Kburton) #2

Are you getting an error of any kind?


(developer!) #3

nothing…its just staying in view itself :(. its not even firing or coming up any message


(Kburton) #4

Is the deletion confirmation message appearing?


(developer!) #5

no nothing happening keith…its just staying in view page…except #coming up in end of the url…what could be the reason??


(Samiloxphp) #6

Use firebug or tamper data to check if your request sent

also try to delete this line in your controller :

public function filters()


{


	return array(


		'accessControl', // perform access control for CRUD operations

////// ‘postOnly + delete’, // delete this line

}

let me know what happened with you


(developer!) #7

thanks for your response samilo,

request is not going… and just # appearing in url at the end.

now, I found some jquery script is blocking it to fire which i have written a week ago. how can i solve this now …


(Samiloxphp) #8

1- check your browser if Javascript was disabled

2- Add your controller code to check your delete problem


(developer!) #9

Solved

this was the javascript error “Uncaught TypeError: Object [object Object] has no method ‘apply’” stopped me to delete it by showing dialogue box…

http://stackoverflow.com/questions/11032659/uncaught-typeerror-object-object-object-has-no-method-apply

i’ve solved this by wrapping my function with function(){}.

as described in the link above. Its working fine now…

.hover(function(){ … });

now i’m getting this “javascript uncaught syntaxerror unexpected token” error after wrapping function with function(){}

trying to solve this error in order to prevent any this kind of problem in future.

but my problem solved :)

Thanks everyone :)