? filefield_ahah_hook_alter.patch Index: filefield.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/filefield/filefield.module,v retrieving revision 1.203 diff -u -p -r1.203 filefield.module --- filefield.module 3 Jul 2009 20:53:07 -0000 1.203 +++ filefield.module 9 Sep 2009 08:43:30 -0000 @@ -504,9 +504,23 @@ function filefield_js($type_name, $field // don't need to call form_set_cache(). $args = $form['#parameters']; $form_id = array_shift($args); - $form['#post'] = $_POST; - $form = form_builder($form_id, $form, $form_state); - + $form_state['post'] = $form['#post'] = $_POST; + $form['#programmed'] = $form['#redirect'] = FALSE; + $form_state['submitted'] = TRUE; + + // For the default "{$form_id}_validate" and "{$form_id}_submit" handlers. + $form['#validate'] = NULL; + $form['#submit'] = NULL; + // For customly set #validate and #submit handlers. + $form_state['submit_handlers'] = NULL; + $form_state['validate_handlers'] = NULL; + // Disable #required and #element_validate validation. + _filefield_js_disable_validation($form); + + + drupal_process_form($form_id, $form, $form_state); + $form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id); + // Update the cached form with the new element at the right place in the form. if (module_exists('fieldgroup') && ($group_name = _fieldgroup_field_get_group($type_name, $field_name))) { if (isset($form['#multigroups']) && isset($form['#multigroups'][$group_name][$field_name])) { @@ -519,7 +533,7 @@ function filefield_js($type_name, $field else { $form_element = $form[$field_name][$delta]; } - + if (isset($form_element['_weight'])) { unset($form_element['_weight']); } @@ -559,6 +573,13 @@ function filefield_js($type_name, $field exit; } +function _filefield_js_disable_validation(&$form) { + foreach (element_children($form) as $child) { + $form[$child]['#validated'] = TRUE; + _filefield_js_disable_validation(&$form[$child]); + } +} + /** * Menu callback for upload progress. */