Hello, in Yii 1 I could ADD aditional parameters in a form submit to send them to a controller processing. For example, if I wanted to know if the user clicked in a "Add" link in the form, I did this:
<?php echo CHtml::link('Add', '#', array('submit'=>'', 'params'=>array('MyParam1'=>'100', 'MyParam2'=>true)));?>
So in the controller I could evaluate the values of those aditional parameters and take appropiate action. The previous code, resulted in this:
<a href="#" id="yt0">Add</a>
<script type="text/javascript">
/*<![CDATA[*/
jQuery(function($) {
jQuery('body').undelegate('#yt0','click').delegate('#yt0','click',function(){jQuery.yii.submitForm(this,'',{'MyParam1':'100','MyParam2':true});return false;});
});
/*]]>*/
</script>
However in Yii 2, the following code:
<?= Html::a('Add', '#', [
'data'=>[
'method' => 'post',
'params'=>['MyParam1'=>'100', 'MyParam2'=>true],
]
]) ?>
Produces this:
<a href="#" data-method="post" data-params="{'MyParam1':'100','MyParam2':true}">Add</a>
The problem is that the link in this example in Yii 2, only sends the parameters specified in the link code, ignoring the rest of the form control values (post parameters).
Any ideas on how to accomplish this in Yii 2? Thank you!