Browse Source

DIV-1127 - Extra decimal places get saved to the system even though they get trimmed on the input field

pull/172/head
Michael Olund 5 years ago
parent
commit
bc87e0c48d
3 changed files with 7 additions and 7 deletions
  1. +6
    -0
      edivorce/apps/core/static/js/ajax.js
  2. +0
    -6
      edivorce/apps/core/static/js/main.js
  3. +1
    -1
      edivorce/apps/core/views/api.py

+ 6
- 0
edivorce/apps/core/static/js/ajax.js View File

@ -2,6 +2,12 @@
var ajaxOnChange = function () {
var el = $(this);
// strip money fields down to 2 decimal places
if (el.hasClass('money')) {
var moneyValue = parseFloat(el.val());
el.val(moneyValue.toFixed(2));
}
// show/hide additional information if needed
reveal(el);


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

@ -775,12 +775,6 @@ $(function () {
showHideChildrenLiveWithOthers();
$('input[name="has_children_under_19"], input[name="has_children_over_19"], input[name="children_financial_support"]').change(showHideChildrenLiveWithOthers);
$('.money').on('change', function() {
var value = parseFloat($(this).val());
$(this).val(value.toFixed(2));
});
$('.positive-integer').on('keypress', function(e) {
// keyCode [95-105] - number page
// keyCode [48-57] - 0-9


+ 1
- 1
edivorce/apps/core/views/api.py View File

@ -49,7 +49,7 @@ class UserResponseHandler(APIView):
if question is None and not user_attribute_updated:
return Response(data="Question: '%s' does not exist" % question_key,
status=status.HTTP_400_BAD_REQUEST)
return Response(status=status.HTTP_500_INTERNAL_ERROR)
return Response(status=status.HTTP_500_INTERNAL_SERVER_ERROR)
return Response(status=status.HTTP_200_OK)


Loading…
Cancel
Save