summaryrefslogtreecommitdiff
path: root/modules/file/file.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/file/file.module')
-rw-r--r--modules/file/file.module8
1 files changed, 2 insertions, 6 deletions
diff --git a/modules/file/file.module b/modules/file/file.module
index 2249b0b81..33868bf4f 100644
--- a/modules/file/file.module
+++ b/modules/file/file.module
@@ -376,6 +376,7 @@ function file_managed_file_process($element, &$form_state, $form) {
'#value' => t('Upload'),
'#validate' => array(),
'#submit' => array('file_managed_file_submit'),
+ '#limit_validation_errors' => array($element['#parents']),
'#ajax' => $ajax_settings,
'#weight' => -5,
);
@@ -389,16 +390,11 @@ function file_managed_file_process($element, &$form_state, $form) {
'#value' => t('Remove'),
'#validate' => array(),
'#submit' => array('file_managed_file_submit'),
+ '#limit_validation_errors' => array($element['#parents']),
'#ajax' => $ajax_settings,
'#weight' => -5,
);
- // Limit validation errors to the file field only. The entire field is needed later
- // by file_field_widget_form(), so the last element is sliced off the #parents array
- // to avoid removing too much from $form_state['values'].
- $element['upload_button']['#limit_validation_errors'] = array(array_slice($element['#parents'], 0, -1));
- $element['remove_button']['#limit_validation_errors'] = array(array_slice($element['#parents'], 0, -1));
-
$element['fid'] = array(
'#type' => 'hidden',
'#value' => $fid,