Hello,
In trying to implement ahah in my custom module I am running into a problem retrieving the cached form.
This is where the call is made:
function boothevents_add_additional_date_to_form() {
//fb($_POST);
$form_state = array(
'storage' => NULL,
'submitted' => FALSE,
'rebuild' => TRUE,
);
$form_build_id = $_POST['form_build_id'];
//fb($form_build_id); jives with db
$cached = cache_get('form_' . $form_build_id, 'cache_form');
//fb($cached); return 0
$form = form_get_cache($form_build_id, $form_state);
//fb($form) returns empty because cache_get returns false
}
I was able to trace the return from cache_get to the following code beginning on line 42 of includes/cache.inc
if ($user->cache > $cache->created) {
// This cache data is too old and thus not valid for us, ignore it.
return 0;
}
I added in some debugging:
if ($user->cache > $cache->created) {
fb($user->cache . ' : ' . $cache->created);
// This cache data is too old and thus not valid for us, ignore it.
return 0;
}
Consecutive clicks of the button with the ahah handler show this debugging info (generated from fb($user->cache . ' : ' . $cache->created); ) :
Click 1:
1337804721 : 1337804628
1337804721 : 1337804628
Click 2:
1337805226 : 1337804628
1337805226 : 1337804628
Click 3:
1337805234 : 1337804628
1337805234 : 1337804628
So the user cache is increasing every time, which I did not know it was supposed to.
If I logout, login, go back to page and click ahah button again:
1337805437 : 1337805434
1337805437 : 1337805434
Already the user cache is higher than cache->created, meaning I will not get the form back.
I appreciate any help and advice on troubleshooting I can get.
Comments
I installed the developer
I installed the developer example modules and same result: the ahah dropdown example will not work because $user->cache > $cache->created returns true. I also granted access to anonymous users and tried while logged out with the same result.
Than it seems that this is
Than it seems that this is something specific to your Drupal installation. Try to do a clean install and see if the cache issue is present.
Thanks for the suggestion. I
Thanks for the suggestion. I did a fresh install and only enabled my custom module and it worked. I then went to original install and deactivated all custom modules, which didn't help. Then deactivated all non-core contributed and it started working.
Now I'm wondering if I should go ahead and take the plunge to 7.x or dive into this and figure out which contrib module was causing it. Any point any contributing debugging work to a 6.x module at this point?
If you do a new project, go
If you do a new project, go for D7. Debugging the issue you have can be done using a php debugger (i.e. xdebug), or you can enable modules one by one and see after which the issue arose.