Yii Framework Forum

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


(Ikramadjissa) #1

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??


(Saurabhdhariwal737) #2

Syntax is improper for posting data on two different actions using two different submit buttons. You should post data by setting form actions on ‘onClick’ event of submit buttons as follows:

Hope this helps you.

Thanks

Saurabh