Commit 3e0d373b authored by mkanat%bugzilla.org's avatar mkanat%bugzilla.org

Bug 388830: Use JS to make sure there's a Description value when submitting an attachment

Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=dkl, a=LpSolit
parent a92f9a32
......@@ -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) {
......
......@@ -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 %]">
......
......@@ -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 %]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment