add javascript form validation to materials upload form
- Legacy-Id: 5919
This commit is contained in:
parent
5855140136
commit
b14e3ddce9
|
@ -83,7 +83,7 @@
|
|||
|
||||
<div class="inline-related">
|
||||
<h2>Upload Materials</h2>
|
||||
<form enctype="multipart/form-data" action="." method="post">
|
||||
<form id="upload_materials_form" enctype="multipart/form-data" action="." method="post">
|
||||
<table class="center" id="proceedings-upload-table">
|
||||
{{ form.as_table }}
|
||||
</table>
|
||||
|
|
|
@ -211,4 +211,15 @@ $(document).ready(function() {
|
|||
init_proceedings_upload();
|
||||
}
|
||||
|
||||
// validate form upload form before uploading file
|
||||
if ($('#upload_materials_form').length) {
|
||||
$('#upload_materials_form').submit(function() {
|
||||
var x=$('#id_slide_name').val();
|
||||
if (x==null || x=="")
|
||||
{
|
||||
$('#id_slide_name').before('<ul class="errorlist"><li>This field is required.</li></ul>');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue