Bug 27967: Add min attribute to borraccount modals
This patch adds a min attribute to the form fields of the borrower account page modals to prevent negative values being entered inappropriately. Test plan 1/ Trigger the refund modal from the borrower account page. 2/ Attempt to enter a negative value for the amount to refund and note with the patch applied you face a validation error (without the patch, upon submission of a negative value you will be faced with a server side error) 3/ Trigger the discount modal from the borrower account page. 4/ Attempt to enter a negative value for the amount to discount and note with the patch applied you face a validation error (without the patch, upon submission of a negative value you will be faced with a server side error) 5/ Signoff Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
1b32e66380
commit
a6d77fb428
|
|
@ -382,7 +382,7 @@
|
|||
var amountoutstanding = button.data('amountoutstanding');
|
||||
var paid = amount - amountoutstanding;
|
||||
$("#paid + span").replaceWith(paid);
|
||||
$("#returned").attr({ "value": paid, "max": paid });
|
||||
$("#returned").attr({ "value": paid, "max": paid, "min": 0 });
|
||||
$("#returned, #refund_transaction_type").focus();
|
||||
});
|
||||
|
||||
|
|
@ -394,7 +394,7 @@
|
|||
$('#discountline').val(accountline);
|
||||
var amount = button.data('amount');
|
||||
$("#charged + span").replaceWith(amount);
|
||||
$("#discount").attr({ "max": amount });
|
||||
$("#discount").attr({ "max": amount, "min": 0 });
|
||||
$("#discount").focus();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue