The workaround I’ve managed to get functional is to use a hidden input in which my btn click sets a value and I use that value in the controller as I don’t seem to be able to directly access the btn’s value directly.
I tried giving both buttons the same name and a value yet in the controller
Yii::$app->request->post('NameOfButton')
never returned a value?
I will try once more because it would be a much cleaner approach than my workaround!
Nope, tried and it always returns null and I don’t understand why. I thought it might be because I set different id’s to the buttons, so I set them to the same as the name so everything would be identical, but it made no difference. My gut is thinking it has to do with the Javascript processing of the form and form.serialize, but this is just a thought and haven’t had time to dig further (already put a lot of time).
It could be that serialize JS code is what causes the problem. In my example there is no any additional form processing, just simple \yiibootstrap\ActiveForm instance which produces simple submit buttons html: