diff --git a/cara/apps/calculator/static/js/form.js b/cara/apps/calculator/static/js/form.js
index a4ea36d5..7195b2a2 100644
--- a/cara/apps/calculator/static/js/form.js
+++ b/cara/apps/calculator/static/js/form.js
@@ -234,9 +234,17 @@ function validate_form(form) {
return submit;
}
-//function validateValue(obj) {
-// $(obj).next('span').remove();
-//}
+function validateNonZero(obj) {
+ $(obj).removeClass("red_border");
+ $(obj).next('span').remove();
+
+ if ($(obj).val() == 0) {
+ $(obj).addClass("red_border");
+ insertSpanAfter(obj, "Value must be > 0");
+ return false;
+ }
+ return true;
+}
function validateDate(obj) {
$(obj).removeClass("red_border");
@@ -314,6 +322,10 @@ $(document).ready(function () {
$("#total_people").change(setMaxInfectedPeople);
$("#activity_type").change(setMaxInfectedPeople);
+ //Validate values > 0
+ $("input[required].non_zero").each(function() {validateNonZero(this)});
+ $(".non_zero").change(function() {validateNonZero(this)});
+
//Validate all dates
$("input[required].datepicker").each(function() {validateDate(this)});
$(".datepicker").change(function() {validateDate(this)});
diff --git a/cara/apps/calculator/templates/calculator.form.html.j2 b/cara/apps/calculator/templates/calculator.form.html.j2
index 941903f1..bacb5ed3 100644
--- a/cara/apps/calculator/templates/calculator.form.html.j2
+++ b/cara/apps/calculator/templates/calculator.form.html.j2
@@ -42,10 +42,10 @@
?
- Room volume:
+ Room volume:
- Floor area:
- Ceiling height:
+ Floor area:
+ Ceiling height: