Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Two confirm dialogs when deleting

Tags:

jquery

php

yii

I have a CMenu code that fires two confirmation dialogs when I try to delete an item.

This is how my CMenu code looks like:

$this->widget('zii.widgets.CMenu', array(
    'items'=>array(
        array('label'=>'List things', 'url'=>array('list')),
        array('label'=>'Delete thing', 'url'=>'#', 'linkOptions'=>array(
            'submit'=>array(
                'delete',
                'id'=>$model->thingID
            ),
            'confirm'=>'Are you sure?'
        )),
    ),
    'htmlOptions'=>array(
        'class'=>'divided'
    )
));

Am I missing something in this code? Why is the confirmation dialog firing twice?

EDIT:

The problem is caused by something inside skel-panel, but I'm not able to find out what exactly is causing it. Any ideas how to disable a href tracking in skel-panel?

EDIT 2:

I found where the problem is coming from, but I'm not sure how to fix it. Thing is skel-panel is wrapping the entire body inside a div. Weird thing is that it strats handling clicks on all hrefs apparently.

The initObjects function is the one that wraps everything (here https://github.com/n33/skelJS/blob/master/src/skel-panels.js )

EDIT 3:

Ok, I found the bug. It's caused somewhere in jQuery and it got fixed between 1.8.3 and 1.9.0.

Where can I get a detailed log of bugs/fixes/patches between those two version so I can cherry-pick only the change I'm interested in? (as I just can't afford the required amount of time to upgrade to jQuery 1.9.x)

like image 779
alexandernst Avatar asked Nov 11 '22 06:11

alexandernst


1 Answers

I think it appears twice because a call to delete from a CMenu already fires the dialog automatically. Try removing the

'confirm' => 'Are you sure?'
like image 157
Jap Mul Avatar answered Nov 15 '22 11:11

Jap Mul