The CSRF token is invalid. Please try to resubmit the form

后端 未结 15 1633
粉色の甜心
粉色の甜心 2020-11-28 10:38

I\'m getting this error message every time I try to submit the form:

The CSRF token is invalid. Please try to resubmit the form

15条回答
  •  爱一瞬间的悲伤
    2020-11-28 11:03

    This seems to be an issue when using bootstrap unless you are rendering the form by {{ form(form)}}. In addition, the issues seems to only occur on input type="hidden". If you inspect the page the with the form, you'll find that the hidden input is not part of the markup at all or it's being rendered but not submitted for some reason. As suggested above, adding {{form_rest(form)}} or wrapping the input like below should do the trick.

提交回复
热议问题