Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

confirm prompt coming twice with yii2 latest version #13357

Closed
anildhiman03 opened this issue Jan 9, 2017 · 10 comments
Closed

confirm prompt coming twice with yii2 latest version #13357

anildhiman03 opened this issue Jan 9, 2017 · 10 comments
Assignees
Labels
JS JavaScript related
Milestone

Comments

@anildhiman03
Copy link

anildhiman03 commented Jan 9, 2017

',
                ['add/remove-img','id'=>$file->id],
                [
                  'data' => [
                     'method' => 'post',
		      'confirm' => 'Confirm msg'
                       ],
                                                        ]
                                                        )?>

now this is the issue with ref with #6642 here confirm prompt coming twice..

@samdark samdark added JS JavaScript related status:to be verified Needs to be reproduced and validated. status:need more info labels Jan 9, 2017
@yii-bot
Copy link

yii-bot commented Jan 9, 2017

Thanks for posting in our issue tracker.
In order to properly assist you, we need additional information:

  • When does the issue occur?
  • What do you see?
  • What was the expected result?
  • Can you supply us with a stacktrace? (optional)
  • Do you have exact code to reproduce it? Maybe a PHPUnit tests that fails? (optional)

Thanks!

This is an automated comment, triggered by adding the label status:need more info.

@anildhiman03
Copy link
Author

When does the issue occur?

  • when trying to generate confirm prompt on HTML::a tag using data['confirm']

What do you see?

  • prompt shows twice. once i click on then again shows same prompt

What was the expected result?

  • it should work only once.

@samdark
Copy link
Member

samdark commented Jan 9, 2017

So it's just HTML::a without any form tags or PJAX?

@anildhiman03
Copy link
Author

yes its just HTML::a tag in but yes its in form but not with $form object.

@samdark
Copy link
Member

samdark commented Jan 9, 2017

Then please edit 1st post to contain full example on how to reproduce it. Thanks.

@yupe
Copy link
Contributor

yupe commented Jan 10, 2017

My code for "delete" button in ActionColumn:

'delete' => function ($url, $model, $key) {
                            $url = \yii\helpers\Url::to(['/url/delete', 'id' => $model->id]);

                            return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, [
                                'title' => 'Удалить',
                                'class' => 'btn btn-sm btn-default',
                                'data-method' => 'post',
                                'data-pjax' => 1,
                                'data-confirm' => 'Вы уверены, что хотите удалить это правило?',
                            ]);
                        },

If i put a grid in the form (ActiveForm) - prompt coming twice.
Without "form" around grid - prompt appears only once.

@samdark
Copy link
Member

samdark commented Jan 10, 2017

One more thing. Are you able to reproduce the same issue using code from master branch?

@alemedinam
Copy link

alemedinam commented Jan 11, 2017

<?php $form = ActiveForm::begin([
        'action' => 'clone',
        'method' => 'POST',
    ]); ?>
                <?= GridView::widget([
                    'dataProvider' => $dataProvider,
                    'columns' => [
                        ['class' => 'yii\grid\SerialColumn'],
                        'Descripcion',
                        [
                            'class' => 'yii\grid\CheckboxColumn',
                            'multiple' => true
                        ],
                    ],
                ]); ?>
        <div class="form-group">
            <?= Html::submitButton('Duplicar preguntas seleccionadas', [
                'class' => 'btn btn-success',
                'data' => [
                    'confirm' => '¿Está seguro?',
                ],
            ]) ?>
        </div>
    <?php ActiveForm::end(); ?>

Same problem without PJAX... v2.0.10

@bariew
Copy link

bariew commented Jan 11, 2017

Hi, having the same issue since 2.0.10

You need to place your link with data-confirm attribute INSIDE yii ActiveForm to reproduce this bug.
So the click event and confirm dialog seem to be fired twice after that.

@samdark samdark added this to the 2.0.11 milestone Jan 12, 2017
@SilverFire
Copy link
Member

Closing this issue as a duplicate of #13255.
Please, visit issue #13255 to continue conversation

@SilverFire SilverFire removed severity:important status:to be verified Needs to be reproduced and validated. labels Jan 14, 2017
@SilverFire SilverFire self-assigned this Jan 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JS JavaScript related
Projects
None yet
Development

No branches or pull requests

7 participants