BeginForm -- several calls of Controller methods

hi guys, following code will create two html elements: Once a button, second a textinputField:




 <?= Html::submitButton('<span class="glyphicon glyphicon-trash"></span>', ['title' => 'Records löschen', 'name' => 'button_checkBoxes']); ?>

<?=


Html::textInput('Searching', 'Search for Mails', ['name' => 'SearchForMail', 'class' => 'form-control input-sm']);?>



My question: How to define static method beginForm of class Html in order to get two different methods in Controller rendered?

submittbutton should render method all($fk) in Controller,

textinput should render MailSearching($p1,$p2) in Controller

This is current status of beginForm()





?><?=

Html::beginForm(['/dateianhang/dateianhang/all', 'fk' => $id], 'post', ['name' => 'idAnhang']);

.

.

$gridColumn = [

.

.

];


<?=

GridView::widget([

.

.

];


<?=

Html::endForm();




A html form can not have 2 or more target actions. You have to use a javascript to do that.

I would probably do it like the following:

  1. Add a jQuery "on change" event handler to the text input.

  2. Submit an ajax call to "mail search" action from the event handler.

  3. And update the relevant fields using the response.

Do I understand your question right?

Okay. Alternatively, I also could give parameter to Controller, so that I can decide,which part of code has to be done.

I think, I will do so,'cause AJAX is overhead for this case.

Bye & thanks for ur answer!