diff options
author | Dries Buytaert <dries@buytaert.net> | 2008-01-04 08:04:45 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2008-01-04 08:04:45 +0000 |
commit | 52f95c981bbf7588aedd1b5cb3ef74641572e39e (patch) | |
tree | fe68523b04bf14977624d831ea6c88acafda510d /modules/poll/poll.module | |
parent | 819772ea650afe95f529a7bda734c0bf8a06bbef (diff) | |
download | brdo-52f95c981bbf7588aedd1b5cb3ef74641572e39e.tar.gz brdo-52f95c981bbf7588aedd1b5cb3ef74641572e39e.tar.bz2 |
- Patch #202078 by chx: fixed poll AHAH problem with caching.
Diffstat (limited to 'modules/poll/poll.module')
-rw-r--r-- | modules/poll/poll.module | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/modules/poll/poll.module b/modules/poll/poll.module index 5150a209d..faafd5df2 100644 --- a/modules/poll/poll.module +++ b/modules/poll/poll.module @@ -330,20 +330,21 @@ function poll_choice_js() { $form_element = _poll_choice_form($delta); drupal_alter('form', $form_element, array(), 'poll_choice_js'); - // Add the new element to the stored form state. Without adding the element - // to the form, Drupal is not aware of this new elements existence and will - // not process it. We retreive the cached form, add the element, and resave. - $cache = cache_get('form_'. $_POST['form_build_id'], 'cache_form'); - $cache->data['choice_wrapper']['choice'][$delta] = $form_element; - cache_set('form_'. $_POST['form_build_id'], $cache->data, 'cache_form', $cache->expire); - // Build the new form. $form_state = array('submitted' => FALSE); - $form = $cache->data; + $form_build_id = $_POST['form_build_id']; + // Add the new element to the stored form. Without adding the element to the + // form, Drupal is not aware of this new elements existence and will not + // process it. We retreive the cached form, add the element, and resave. + $form = form_get_cache($form_build_id, $form_state); + $form['choice_wrapper']['choice'][$delta] = $form_element; + form_set_cache($form_build_id, $form, $form_state); $form += array( '#post' => $_POST, '#programmed' => FALSE, ); + + // Rebuild the form. $form = form_builder('poll_node_form', $form, $form_state); // Render the new output. |