Quick Q that I did not see answered elsewhere. How does block caching impact forms? Specifically, let's say I put a number of forms in blocks, such as the user registration form, perhaps the "invite a user" form from the invite module, etc. Any form that collects information from the user and submits it back to the site. These forms could be used by both authenticated and unauthenticated users.

Upon initiation of the load of the page/block, the form has a form_build_id and form_token set by drupal_get_form. If the block is cached, won't it also cache the tokens for the block? Would this present itself as an issue if we were to select block caching by anything but per user? And even if we did select caching per user, would that present an issue for anonymous users? What if the block was set to cache globally for an extended period of time (minimum cache time of let's say a week)? Is there a timer for drupal_get_form tokens that will expire?

What I'm ultimately trying to work out are the 'rules' for using block caching when forms are present in the block. Right now I have them set to "do not cache". I'd be interested in recommendations for the following scenarios:

Anonymous users only, blocks with forms
Mixed Anonymous+Authenticated users, blocks with forms

Let's assume that the only thing in the block is a form and we aren't having to think about any other type of content.

Thanks!

FAPI Quickstart: http://drupal.org/node/751826
drupal_get_form: http://api.drupal.org/api/drupal/includes--form.inc/function/drupal_get_...

Comments

swentel’s picture

I guess you'd have to find this out for Drupal Core in general. Block caching is in core and all this module does is enhancing it a bit more, so technically, this isn't a support request for this module :)

I've actually never experienced any problems so far. Also when global page caching is enabled, the user login form also works, so I'm I guess for anonymous users this shouldn't be problem. Same for authenticated users I guess. Looking at the code of drupal_get_form, the id is built like this:

form_build_id = 'form-' . md5(uniqid(mt_rand(), TRUE));

So there is nothing used from the user here.

I'll leave the thread open for now, but I'm pretty sure the answer should be out there somewhere.

swentel’s picture

Status: Active » Closed (works as designed)

Closing this one, support requests for this kind of stuff should be asked in either Post installations forums or so since this is Drupal core.