When i try to perform massdelete action from frontend grid using uicomponent than it has throws invalid form key error. Does anyone know how we can use form key in frontend grid ?
1 Answer
Please add following code in your controller :
protected $request;
protected $formKey;
public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Framework\Data\Form\FormKey $formKey,
\Magento\Framework\App\Request\Http $request
) {
$this->request = $request;
$this->formKey = $formKey;
$this->request->setParam('form_key', $this->formKey->getFormKey());
parent::__construct($context);
}
-
-
Doesn't this simply disable the form key validation instead of fixing the cause of the missing form key?– ImanuelDec 26, 2020 at 10:41