diff options
-rw-r--r-- | js/attachment.js | 9 | ||||
-rw-r--r-- | template/en/default/attachment/create.html.tmpl | 4 | ||||
-rw-r--r-- | template/en/default/global/header.html.tmpl | 5 |
3 files changed, 17 insertions, 1 deletions
diff --git a/js/attachment.js b/js/attachment.js index d3ba26796..b62555fbe 100644 --- a/js/attachment.js +++ b/js/attachment.js @@ -21,6 +21,15 @@ * 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) { diff --git a/template/en/default/attachment/create.html.tmpl b/template/en/default/attachment/create.html.tmpl index c265ae567..0b965bc4e 100644 --- a/template/en/default/attachment/create.html.tmpl +++ b/template/en/default/attachment/create.html.tmpl @@ -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 %]"> diff --git a/template/en/default/global/header.html.tmpl b/template/en/default/global/header.html.tmpl index 3116f0019..f8044976d 100644 --- a/template/en/default/global/header.html.tmpl +++ b/template/en/default/global/header.html.tmpl @@ -206,6 +206,11 @@ var BUGZILLA = { param: { cookiepath: '[% Param('cookiepath') FILTER js %]' + }, + + string: { + attach_desc_required: + 'You must enter a Description for this attachment.' } }; [% IF javascript %] |