Check if number field is null before submit application for beans
This commit is contained in:
parent
4c3b11cc25
commit
62fdaa489e
|
@ -50,14 +50,14 @@
|
||||||
<form action="/beans/apply/" method="POST" id="beansapplyForm">
|
<form action="/beans/apply/" method="POST" id="beansapplyForm">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Number</label><small class="font-bold"> How many beans do you need?</small>
|
<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>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Reason</label>
|
<label>Reason</label>
|
||||||
<textarea class="form-control" name="reason" cols="28" rows="5" onKeyDown="textCounter(reason,remLen,300);" onKeyUp="textCounter(reason,remLen,300);" placeholder="Please describe what you will do in your workspace with the beans."></textarea>
|
<textarea class="form-control" name="reason" cols="28" rows="5" onKeyDown="textCounter(reason,remLen,300);" onKeyUp="textCounter(reason,remLen,300);" placeholder="Please describe what you will do in your workspace with the beans."></textarea>
|
||||||
You could only input <input name="remLen" type="text" value="300" size="3" readonly="readonly"> more characters.
|
You could only input <input name="remLen" type="text" value="300" size="3" readonly="readonly"> more characters.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-white" data-dismiss="modal">Close</button>
|
<button type="button" class="btn btn-white" data-dismiss="modal">Close</button>
|
||||||
<button type="submit" class="btn btn-primary">Submit</button>
|
<button type="submit" class="btn btn-primary">Submit</button>
|
||||||
|
@ -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/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/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="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>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$(".table-image").DataTable();
|
$(".table-image").DataTable();
|
||||||
});
|
});
|
||||||
|
$().ready(function() {
|
||||||
|
$("#beansapplyForm").validate();
|
||||||
|
});
|
||||||
function textCounter(field,countfield,maxlimit)
|
function textCounter(field,countfield,maxlimit)
|
||||||
{
|
{
|
||||||
if(field.value.length > maxlimit)
|
if(field.value.length > maxlimit)
|
||||||
|
@ -116,7 +120,7 @@ function textCounter(field,countfield,maxlimit)
|
||||||
else
|
else
|
||||||
countfield.value = maxlimit - field.value.length;
|
countfield.value = maxlimit - field.value.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue