Skip to content

Commit b14e3dd

Browse files
committed
add javascript form validation to materials upload form
- Legacy-Id: 5919
1 parent 5855140 commit b14e3dd

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

ietf/secr/templates/proceedings/upload_unified.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ <h2>Slides&nbsp;&nbsp;<span class="highlight">NEW! Drag and drop to re-order sl
8383

8484
<div class="inline-related">
8585
<h2>Upload Materials</h2>
86-
<form enctype="multipart/form-data" action="." method="post">
86+
<form id="upload_materials_form" enctype="multipart/form-data" action="." method="post">
8787
<table class="center" id="proceedings-upload-table">
8888
{{ form.as_table }}
8989
</table>

static/secr-static/js/utils.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,4 +211,15 @@ $(document).ready(function() {
211211
init_proceedings_upload();
212212
}
213213

214+
// validate form upload form before uploading file
215+
if ($('#upload_materials_form').length) {
216+
$('#upload_materials_form').submit(function() {
217+
var x=$('#id_slide_name').val();
218+
if (x==null || x=="")
219+
{
220+
$('#id_slide_name').before('<ul class="errorlist"><li>This field is required.</li></ul>');
221+
return false;
222+
}
223+
});
224+
}
214225
});

0 commit comments

Comments
 (0)