From 8ca685e08962221ad10db08fe4fa7761c5c13544 Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Mon, 31 Jan 2011 20:38:00 -0600 Subject: [PATCH] add file input for progressive enhancement and testing --- lib/WebGUI/Form/File.pm | 5 ++++- www/extras/FileUploadControl.js | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/WebGUI/Form/File.pm b/lib/WebGUI/Form/File.pm index 7a860e808..e77d6a09d 100644 --- a/lib/WebGUI/Form/File.pm +++ b/lib/WebGUI/Form/File.pm @@ -293,7 +293,10 @@ sub toHtml { my @files = @{ $storage->getFiles } if (defined $storage); my $maxFiles = $self->get('maxAttachments') - scalar(@files); if ($maxFiles > 0) { - $uploadControl = '' diff --git a/www/extras/FileUploadControl.js b/www/extras/FileUploadControl.js index 687254f73..38de29af4 100644 --- a/www/extras/FileUploadControl.js +++ b/www/extras/FileUploadControl.js @@ -4,6 +4,11 @@ function FileUploadControl(fieldName, imageArray, removeLabel, fileLimit, size) { + + // Remove the existing field + var replace = document.getElementById( fieldName ); + replace.parentNode.removeChild( replace ); + this.images = imageArray; this.fileLimit = fileLimit; this.fileCount = 1;