Merge pull request #322 from FirmlyReality/master

Check if number field is null before submit application for beans
This commit is contained in:
Yujian Zhu 2018-08-07 17:43:22 +08:00 committed by GitHub
commit d64b39bcc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -50,7 +50,7 @@
<form action="/beans/apply/" method="POST" id="beansapplyForm">
<div class="form-group">
<label>Number</label><small class="font-bold"> How many beans do you need?</small>
<input type="number" class="form-control" placeholder="100-5000" name="number" id="number" min="100" max="5000"/>
<input type="number" class="form-control" placeholder="100-5000" name="number" id="number" min="100" max="5000" required />
</div>
<div class="form-group">
<label>Reason</label>
@ -104,11 +104,15 @@
<script src="http://cdn.bootcss.com/datatables/1.10.11/js/jquery.dataTables.js"></script>
<script src="http://cdn.bootcss.com/datatables/1.10.11/js/dataTables.bootstrap.js"></script>
<script src="http://cdn.bootcss.com/datatables-tabletools/2.1.5/js/TableTools.min.js"></script>
<script src="https://cdn.bootcss.com/jquery-validate/1.17.0/jquery.validate.js"></script>
<script>
$(document).ready(function() {
$(".table-image").DataTable();
});
$().ready(function() {
$("#beansapplyForm").validate();
});
function textCounter(field,countfield,maxlimit)
{
if(field.value.length > maxlimit)
@ -116,7 +120,7 @@ function textCounter(field,countfield,maxlimit)
else
countfield.value = maxlimit - field.value.length;
}
</script>
{% endblock %}