Changing Form Cache for AHAH manipulation

  1. function ehu_photos_js() {
  2.   $cache = cache_get('form_'.$_POST['form_build_id'], 'cache_form');
  3.  
  4.   $node = (object)$_POST;
  5.   $form = $cache->data;
  6.   $form_state = array('values' => $_POST);
  7.  
  8.   // ....
  9.  
  10.   $cache->data['ehu_photos']['photos']['#value'][$fid] = $file;
  11.   $cache->data['ehu_photos']['epwrapper']['#value'] = $html;
  12.  
  13.   cache_set('form_'. $_POST['form_build_id'], $cache->data, 'cache_form', $cache->expire);
  14.  
  15.   $status = true;
  16.  
  17.   print drupal_to_js(array('status'=>$status, 'data'=>$output));
  18.   exit;
  19. }