开发者

Why would a Drupal form not be cached in cache_form?

开发者 https://www.devze.com 2022-12-31 19:45 出处:网络
My form, lets call it organize_issue, is a form in a custom module being called from the menu using the page callback drupal_get_form function. The form works perfectly well.

My form, lets call it organize_issue, is a form in a custom module being called from the menu using the page callback drupal_get_form function. The form works perfectly well.

I'm trying to implement some AHAH type functionality now, and need to get the page from cache using form_get_cache($form_build_id, $form_state) but, oddly enough, my form isn't being cached. Ever. Other forms on the site are, just no开发者_如何学Pythont this one. As I said the form works fine, and submits and validates and whatnot... it just never caches. Is their something simple I'm missing?


In your function that builds the form you should have a value setting the form to cache...

Should look some thing like '#cache' => TRUE, if you don't see it that might be why your form isn't caching...you should be building your form on a way that the array of the form sets it to cache:

<?php
  function _organize_issue_form($node) {
    global $user;

 $form = array(
   '#theme' => 'organize_issue',
   '#cache' => TRUE,
 );
?>

HTH

0

精彩评论

暂无评论...
验证码 换一张
取 消