]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 388830: Use JS to make sure there's a Description value when submitting an attachment
authormkanat%bugzilla.org <>
Mon, 21 Sep 2009 22:02:28 +0000 (22:02 +0000)
committermkanat%bugzilla.org <>
Mon, 21 Sep 2009 22:02:28 +0000 (22:02 +0000)
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=dkl, a=LpSolit

js/attachment.js
template/en/default/attachment/create.html.tmpl
template/en/default/global/header.html.tmpl

index d3ba267967bbe33f4ffb7540f93b4f06da225e26..b62555fbe4005ffac66e7cfa04f61ab8453ec261 100644 (file)
  *                 Marc Schumann <wurblzap@gmail.com>
  */
 
+function validateAttachmentForm(theform) {
+    var desc_value = YAHOO.lang.trim(theform.description.value);
+    if (desc_value == '') {
+        alert(BUGZILLA.string.attach_desc_required);
+        return false;
+    }
+    return true;
+}
+
 function updateCommentPrivacy(checkbox) {
     var text_elem = document.getElementById('comment');
     if (checkbox.checked) {
index c265ae567af0df5abbdf22a540063ab0a927524e..0b965bc4ef7e8b0d7ad74cd0f7f1c0d92cb7e32c 100644 (file)
@@ -38,7 +38,9 @@
   doc_section = "attachments.html"
 %]
 
-<form name="entryform" method="post" action="attachment.cgi" enctype="multipart/form-data">
+<form name="entryform" method="post" action="attachment.cgi"
+      enctype="multipart/form-data"
+      onsubmit="return validateAttachmentForm(this)">
   <input type="hidden" name="bugid" value="[% bug.bug_id %]">
   <input type="hidden" name="action" value="insert">
   <input type="hidden" name="token" value="[% token FILTER html %]">
index 3116f0019a53a099978acb11eb5d92e86b9bba53..f8044976db08fb73d94077c176c3f4b99c486b7e 100644 (file)
         var BUGZILLA = {
             param: {
                 cookiepath: '[% Param('cookiepath') FILTER js %]'
+            },
+
+            string: {
+                attach_desc_required:
+                    'You must enter a Description for this attachment.'
             }
         };
         [% IF javascript %]