Form submission is not working for POST method


#1

I’ve just started working on pimcore 5 and working on my custom bundle and have some doubts related to it-

  1. I’m using symfony form builder and when I’m using POST method it is throwing exception as below
    Detected CSRF Attack! Do not do evil things with pimcore … :wink:
    but it is working fine with GET method. What am I doing wrong in this? Form has been created for admin side and route has prefix admin.

  2. Is there any other way to work with forms?

  3. Is there any other way to work with data object classed except creating it manually from admin? Can it be created while installing bundle?

  4. Can I build form using these data object classes?

Thanks for the help in advance :slight_smile:


#2

For the CSRF I had to do the following before it worked for me.

In my template I added below row to my form.

<input type="hidden" name="csrfToken" value="<?= $this->csrfToken ?>">

And this to my controller

$this->checkCsrfToken($request);

Don’t remember all the details at this time, but hope it helps you somehow :slight_smile:


#3

Hi @AndrewAteles
It doesn’t seems to work for me.
I’ve tried another to to put entry of routes in the services and now it is working. But it doesn’t seems to me permanent solution (ignoring routes for csrf validation) .
If you have any other solution, please let me know.

What about the other questions?

Thanks