link with data-method post inside ActiveForm submits to form action instead of link url

Hello Guys,

Today I made an composer update in one of my existing projects.

And together with other things Yii was updated from Yii 2.0.7 to 2.0.9

Now I noticed following:

I have some update-forms which have a "delete" link-button directly next to the submit button. (inside the ActiveForm Tags)

And the delete link-buttons do not submit to the "delete" action anymore.

Instead they submit to the "update" action of the form.

When I move the Delete button out of the ActiveForm Tags they will work and submit to "delete" action again…

The form & delete button looks for example like this:




<?php

$form = ActiveForm::begin([

    'enableClientValidation' => false,

    'enableClientScript' => false,

    'options' => ['enctype'=>'multipart/form-data'],

]);

?>


// ... ... ... Other Form Inputs 


<?= Html::submitButton("Update", ['class'=>'btn btn-success']) ?>


<?= Html::a('Delete', ['delete', 'id' => $model->id], [

    'class'         => 'btn btn-danger',

    'data'          => [

        'method'    => 'post',

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

    ]

]); ?>


<?php ActiveForm::end(); ?>



Using google I found some similar topics on github for this problems for example:

But all topics seem to be old and no newer issues are reported for 2.0.9 as far as I have read.

Also in the changelog:

… the last changes to "data-method" and "data-confirm" were in 2.0.7 (which I was already using.)

Now my questions are:

What am I missing? And or what has changed that this is not working anymore?

Do I HAVE TO move the button out of the form tags?

Is there any proposed / nice solution to have a delete button directly next to the submit button?

OR is is it maybe some other bug on my end that I have not found yet?

Thanks in advance for your replies.

Best Regards

Okay…

Since it seem to work with a fresh basic application,

I guess the problem is caused somewhere else in my code.

Thanks anyway guys.