make Html::resetButton also refresh page

I’m struggling to figure some of this out myself - i really wish we could get more documentation.

I am just trying to have a resetButton that refreshes the page as well as clears the form fields.

I tried




<?= Html::resetButton('Reset', ['value' => Url::to('index.php?r=sale/index'), 'class' => 'btn btn-default']) ?>



but nothing happens. Please help :-[

Why would you want to reset a form if you will refresh the page? If you refresh a page (without submit data) the form will be reset anyway.

PS: ::resetButton() has not an option to make it refresh the page. If you really need this (even seeming a bit strange) you will need to use js.

oh no, this is not a form - its an index page with gridview on it - so the refresh button is for the search fields - which are naturally ActiveForm fields