diff --git a/plupload.js b/plupload.js index f8be4d1..cda096d 100644 --- a/plupload.js +++ b/plupload.js @@ -62,6 +62,13 @@ Drupal.behaviors.plupload = { // completed uploading. // @todo Implement a setting for whether the field is required, rather // than assuming that all are. + if (uploader.files.length == 0 && !pluploadSettings.required) { + for (var attr in originalFormAttributes) { + $form.attr(attr, originalFormAttributes[attr]); + } + return; + } + if (uploader.files.length > 0 && uploader.total.uploaded == uploader.files.length) { // Plupload's html4 runtime has a bug where it changes the attributes // of the form to handle the file upload, but then fails to change diff --git a/plupload.module b/plupload.module index a37a62a..991bb79 100644 --- a/plupload.module +++ b/plupload.module @@ -220,6 +220,8 @@ function plupload_element_pre_render($element) { ); } + $settings['required'] = $element['#required']; + if (empty($element['#description'])) { $element['#description'] = ''; }