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 ?

  • please Try to clear the cache from var/cache directory. Then clear browser cache. Especially clear or delete cookies. – Chirag Gondaliya Oct 7 at 9:13
  • no man i already tried all these things but nothing happens same issue arise – Sanjay Shiyal Oct 7 at 9:17

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());
  • Thanks @chirag you save my day , working great !!! – Sanjay Shiyal Oct 7 at 9:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.