SSiwek
(Sven Siwek)
December 6, 2018, 9:41am
1
Hi,
I need a Cancel Button which does call my controller.
I want to have client validation in my form, but I also want a “Cancel Button”.
I havent found any option/parameter for html::a or html::submitButton to switch off validation on just that button.
I am aware of "‘enableClientValidation’=>false, " which does disable clientvalidation for whole form, which I wont want.
Any help appreciated
Sven
jaimez
(Jaimez)
December 6, 2018, 1:54pm
2
Why do you need to disable client validation in this situation ? As far as I know client validation is fired only when input element lost focus. When you click on the button, unless it is submit button, no validation should be ran.
maxkoa
(maxkoa)
September 27, 2021, 3:23am
3
Hi!, I am having the same issue. Were you able to solve this?
SSiwek
(Sven Siwek)
September 27, 2021, 5:35am
4
I do something like the following
In my view
<?= Html::a('Cancel',['erfassen/cancel','id'=>$model->id],
[
'class' => 'btn btn-warning ',
'accesskey' => 'c',
]) ?>
In the Controller
public function actionCancel($id)
{
/**
* special id handling ...
**/
return $this->redirect("index");
}