diff --git a/edivorce/apps/core/static/js/main.js b/edivorce/apps/core/static/js/main.js index 27f906c2..9aafe4fc 100755 --- a/edivorce/apps/core/static/js/main.js +++ b/edivorce/apps/core/static/js/main.js @@ -599,6 +599,16 @@ $(function () { $(this).val(value.toFixed(2)); }); + $('.positive-integer').on('keypress', function(e) { + // keyCode [95-105] - number page + // keyCode [48-57] - 0-9 + // keyCode [8] - backspace + // keyCode [37-40] - directional arrows + if (!((e.which > 95 && e.which < 106) || (e.which > 47 && e.which < 58) || e.which === 8 || (e.keyCode > 36 && e.keyCode < 41))) { + e.preventDefault(); + } + }); + $('.fact-sheet-input').on('focus', function() { $(this).closest('td').addClass('table-cell-active'); }).on('focusout', function() { diff --git a/edivorce/apps/core/templates/question/06_children_facts.html b/edivorce/apps/core/templates/question/06_children_facts.html index f9b923cc..c3fdf904 100644 --- a/edivorce/apps/core/templates/question/06_children_facts.html +++ b/edivorce/apps/core/templates/question/06_children_facts.html @@ -244,7 +244,7 @@ (the child spends at least 40 percent of the time with each of you in a year). If you and your spouse have a split parenting arrangement for any other children, do not include them in this set of questions.
- {% input_field type="number" name="number_of_children" class="form-control input-narrow" min="0" %} + {% input_field type="number" name="number_of_children" class="form-control input-narrow positive-integer" min="0" %}