How can I have two submit buttons with different actions in one form

How can I have two submit buttons with different actions in one form . I have two actions (listenouvelleacqui, and listenouvelleacquiaffect)I am trying to include this code in my form but it’s not working. it is working only with one action (listenouvelleacqui).


<div class="col-lg-12">

    

        <?= Html::SubmitButton( 'Mettre en instance',['listenouvelleacqui', 'class' => 'btn btn-primary '] ) ?> 

   

        <?= Html::SubmitButton( 'Affecter',['listenouvelleacquiaffect','class' => 'btn btn-primary ' ] ) ?> 

  </div>

How to do that plz, any help??

Use jQuery on form submit to submit to the correct action.

Simple way is to change the form URL to the correct action with jQuery and then submit the form using submit();




<div class="col-lg-12">

	

  <?= Html::SubmitButton( 'Mettre en instance', [

	'formaction' => Url::toRoute( 'listenouvelleacqui'),

	'class' => 'btn btn-primary ',

] ) ?> 

   

  <?= Html::SubmitButton( 'Affecter', [

	'formaction' => Url::toRoute('listenouvelleacquiaffect'),

	'class' => 'btn btn-primary ',

 ] ) ?> 

  </div>