views:

382

answers:

2

Hi.

How can I use filter action from page that not contain filter form (e.g. by submit or GET request)?

When I pass parameters in the following URL

<module_name>/filter/action?module_filters[_csrf_token]=62a17afab45d56382974f9a495abee7c&module_filters[id]=3998

I get an error in filter form:

csrf token: CSRF attack detected.

or

<module_name>/filter/action?module_filters[id]=3998

csrf token Required

When I execute

$filters -> disableCSRFProtection()

in my template, nothing happens.

A: 

I think you should be able to do this your template with:

$form->disableCSRFProtection();

Or you can disable CSRF in your form class with this:

$this->disableLocalCSRFProtection();

Or you can render it as part of your form in your template with this:

$form['_csrf_token']->render();

Hope that helps.

Tom
A: 

Hi, I have exactly the same problem as above and everything that you've suggested didn't help. This problem concerns only filter form not general form.

Does anyone solve this problem? Because of this bug I don't know how I can use filters at all

AlekSander
I solve this problem by overriding the constructor of form filter class:public function __construct($defaults = array(), $options = array(), $CSRFSecret = null) { parent::__construct($defaults, $options, false); }Hope that helps somebody ;)
AlekSander