Skip to content

Commit

Permalink
Fix Parlsey Validation on Removed Transfer Form Rows
Browse files Browse the repository at this point in the history
Fix a bug preventing form submission on the Transfer Entry page caused
by parsley attempting to validate removed rows.
  • Loading branch information
prikhi committed Feb 5, 2018
1 parent 0ab6778 commit 9177e5f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions acornaccounting/entries/templates/entries/transfer_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
});
});
function addActions(row) {
$(".source").each(function() {
$("#transaction-table .source").each(function() {
var that = this;
$(this).blur(function(){
assignRequired.call(that);
});
});
$(".destination").each(function() {
$("#transaction-table .destination").each(function() {
var that = this;
$(this).blur(function(){
assignRequired.call(that);
});
});
$(".amount").each(function() {
$("#transaction-table .amount").each(function() {
var that = this;
$(this).blur(function(){
assignRequired.call(that);
Expand All @@ -47,8 +47,8 @@
}
function assignRequired() {
/* Set Account and Amount widgets to required if either is set */
$source = $(this).closest('tr').find('.source');
$destination = $(this).closest('tr').find('.destination');
$source = $(this).closest('tr').find('select.source');
$destination = $(this).closest('tr').find('select.destination');
$amount = $(this).closest('tr').find('.amount');
if ((($amount.val().length != 0) || ($source.val().length != 0) ||
($destination.val().length != 0)) && $source.is(':visible')) {
Expand All @@ -63,8 +63,8 @@
}
function removeRow(row) {
/* Remove validation from deleted rows */
$source = $(row).find('.source');
$destination = $(row).find('.destination');
$source = $(row).find('select.source');
$destination = $(row).find('select.destination');
$amount = $(row).find('.amount');
$('#entry_form').parsley('removeItem', $source);
$('#entry_form').parsley('removeItem', $destination);
Expand Down

0 comments on commit 9177e5f

Please sign in to comment.