summaryrefslogtreecommitdiff
path: root/modules/file/file.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-03-26 18:58:12 +0000
committerDries Buytaert <dries@buytaert.net>2010-03-26 18:58:12 +0000
commitc327b4d407c0fc3ea74037789214b23d2b35e9a0 (patch)
treeb03f23a11760e8f511bf9d5b0d3781f5a16a4458 /modules/file/file.module
parenta7d001f7d18c738875fc846dbb719c4bbdf9272b (diff)
downloadbrdo-c327b4d407c0fc3ea74037789214b23d2b35e9a0.tar.gz
brdo-c327b4d407c0fc3ea74037789214b23d2b35e9a0.tar.bz2
- Patch #684846 by effulgentsia, rfay, quicksketch, aspilicious: AJAX triggered by non-submit element fails if any elements are validated.
Diffstat (limited to 'modules/file/file.module')
-rw-r--r--modules/file/file.module12
1 files changed, 6 insertions, 6 deletions
diff --git a/modules/file/file.module b/modules/file/file.module
index d0f95cfb8..0eba84715 100644
--- a/modules/file/file.module
+++ b/modules/file/file.module
@@ -385,12 +385,12 @@ function file_managed_file_process($element, &$form_state, $form) {
'#weight' => -5,
);
- // Because the output of this field changes depending on the button clicked,
- // we need to ask FAPI immediately if the remove button was clicked.
- // It's not good that we call this private function, but
- // $form_state['clicked_button'] is only available after this #process
- // callback is finished.
- if (_form_button_was_clicked($element['remove_button'], $form_state)) {
+ // @todo It is not good to call these private functions. This should be
+ // refactored so that the file deletion happens during a submit handler,
+ // and form changes affected by that (such as toggling the upload and remove
+ // buttons) happens during the 2nd run of this function that is triggered by
+ // a form rebuild: http://drupal.org/node/736298.
+ if (_form_button_was_clicked($element['remove_button'], $form_state) || _form_element_triggered_scripted_submission($element['remove_button'], $form_state)) {
// If it's a temporary file we can safely remove it immediately, otherwise
// it's up to the implementing module to clean up files that are in use.
if ($element['#file'] && $element['#file']->status == 0) {