From 3bc006f4a7ca43a48f8b96d2de9b8a50dbbb216a Mon Sep 17 00:00:00 2001
From: Andreas Gohr <andi@splitbrain.org>
Date: Thu, 9 Mar 2006 19:46:01 +0100
Subject: [PATCH] fixed id suggestion in upload dialog

darcs-hash:20060309184601-7ad00-a1e8e9dfb0fe5cab69aa982809c712b77e2eccfd.gz
---
 lib/scripts/script.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/scripts/script.js b/lib/scripts/script.js
index 24dc025bc..e05aeb0fe 100644
--- a/lib/scripts/script.js
+++ b/lib/scripts/script.js
@@ -163,12 +163,15 @@ function mediaSelect(file){
  * For the upload Dialog. Prefills the wikiname.
  */
 function suggestWikiname(){
-  var file = document.upload.upload.value;
+  var form = $('dw__upload');
+  if(!form) return;
+
+  var file = form.elements.upload.value;
 
   file = file.substr(file.lastIndexOf('/')+1);
   file = file.substr(file.lastIndexOf('\\')+1);
 
-  document.upload.id.value = file;
+  form.elements.id.value = file;
 }
 
 /**
-- 
GitLab