tklustig
(Kipp Thomas)
1
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();
softark
(Softark)
2
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:
-
Add a jQuery "on change" event handler to the text input.
-
Submit an ajax call to "mail search" action from the event handler.
-
And update the relevant fields using the response.
Do I understand your question right?
tklustig
(Kipp Thomas)
3
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!