Then I don’t use yii confirmation dialog i can see submit button’s name and value in post request.
If I use yii confirmation dialog i can’t see submit button’s name and value in post request.
How to see them when yii confirmation dialog is used?
For example, if form contains such button:
<?= Html::submitButton('name', ['name' => 'action', 'value' => 'submitButtonValue']); ?>
It will have such post attributes:
["action"]=> string(12) "submitButtonValue"
On the other hand, if form contains button with yii confirmation dialog:
<?= Html::submitButton('name', ['name' => 'action', 'value' => 'submitButtonValue',
'data' => [
'confirm' => 'Are you sure?',
'method' => 'post'
],
]); ?>
It wont contain "action=>’submitButtonValue’" attribute in the post request.
I tried to put name and value in data section, but it did not help.
'data' => [
'confirm' => 'Are you sure?',
'method' => 'post',
'name' => 'action',
'value' => 'submitButtonValue'
],
2
Answers
This worked for me, writing the data-attributes explicitly:
You can add a hiddenInput to your form.