Browse Source

DIV-691,DIV-696: only allow positive integers when user enters number of children

pull/160/head
Benard Ebinu 8 years ago
parent
commit
290e64de97
2 changed files with 12 additions and 2 deletions
  1. +10
    -0
      edivorce/apps/core/static/js/main.js
  2. +2
    -2
      edivorce/apps/core/templates/question/06_children_facts.html

+ 10
- 0
edivorce/apps/core/static/js/main.js View File

@ -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() {


+ 2
- 2
edivorce/apps/core/templates/question/06_children_facts.html View File

@ -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.
</p>
{% 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" %}
</div>
<br />
@ -582,7 +582,7 @@
How many child(ren) are 19 years or older for whom you are asking for support?
</p>
<div>
{% input_field type="number" name="number_children_over_19_need_support" class="fact-sheet-input input-narrow" %}
{% input_field type="number" name="number_children_over_19_need_support" class="fact-sheet-input input-narrow positive-integer" %}
</div>
</div>


Loading…
Cancel
Save