Skip to content

Commit

Permalink
This commit should fix "federal loan over cost of attendance" errors …
Browse files Browse the repository at this point in the history
…when the

user focusouts from the relevant input.
  • Loading branch information
mistergone committed Aug 8, 2016
1 parent 111065d commit bbeb339
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/disclosures/js/views/financial-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ var financialView = {
*/
updateCalculationErrors: function( values ) {
var errors = values.errors;

// hide errors
$( '[data-calc-error]' ).hide();

Expand Down Expand Up @@ -370,17 +369,25 @@ var financialView = {
'perkinsOverCost', 'subsidizedOverCost',
'unsubsidizedOverCost', 'gradPlusOverCost'
],
errorMap = {
subsidizedOverCost: 'contrib__subsidized',
unsubsidizedOverCost: 'contrib__unsubsidized',
perkinsOverCost: 'contrib__perkins',
gradPlusOverCost: 'contrib__direct-plus'
},
showOverBorrowing = false,
$over = $( '[data-calc-error="overBorrowing"]' );
$over = $( '[data-calc-error="overBorrowing"]' ),
errorInput;

// check for over-borrowing
for ( var i = 0; i < overBorrowingErrors.length; i++ ) {
if ( errors.hasOwnProperty( overBorrowingErrors[i] ) ) {
showOverBorrowing = true;
errorInput = errorMap[overBorrowingErrors[i]];
}
}
if ( showOverBorrowing ) {
var $current = $( '#' + financialView.currentInput );
var $current = $( '#' + errorInput );
$over.appendTo( $current.parent() ).show();
}
},
Expand Down

0 comments on commit bbeb339

Please sign in to comment.