Replies: 1 comment 2 replies
-
Yep, it's actually on my list to add some better handling for statically-cached forms, but this might be in addition to that. I know that So just to clarify, I just need to omit the CSRF input altogether - no refreshing required? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We frequently find that pages with Formie forms on them that call
formie.renderForm()
are not cacheable, because they always render a CSRF token.Formie's docs (geared toward Blitz instead of the Cloud) show you how to refresh those tokens on init, but because there is no way to omit the CSRF input, in that scenario the cached item would still end up with a CSRF token from whoever hit it first. Which, is a bit awkward, and in the case of Craft Cloud, would never be eligible to be cached in the first place.
We generally instruct people to either:
CRAFT_ASYNC_CSRF_INPUTS=true
so that when formie renders the CSRF input, it will be async and not block caching. This generally does the trick, but is a global setting, and may not be compatible with custom form handling js.{{ csrfInput() }}
function options.So, the goal would be to optionally either omit or customize the csrf input when calling
formie.renderForm()
.A simple idea could be to just have some kind of
csrfInputHtml
setting, where you could provide it in its entirety:Beta Was this translation helpful? Give feedback.
All reactions