Added the validateRecord() validation in the JavaScript of the transaction form, so that users have to explicitly delete the invalid records before submitting the form in the accounting application.
This commit is contained in:
parent
1f0ec979ae
commit
61da336188
@ -338,6 +338,12 @@ function resetRecordButtons() {
|
|||||||
function validateForm() {
|
function validateForm() {
|
||||||
let isValidated = true;
|
let isValidated = true;
|
||||||
isValidated = isValidated && validateDate();
|
isValidated = isValidated && validateDate();
|
||||||
|
$(".debit-record").each(function () {
|
||||||
|
isValidated = isValidated && validateRecord(this);
|
||||||
|
});
|
||||||
|
$(".credit-account").each(function () {
|
||||||
|
isValidated = isValidated && validateRecord(this);
|
||||||
|
});
|
||||||
$(".record-account").each(function () {
|
$(".record-account").each(function () {
|
||||||
isValidated = isValidated && validateAccount(this);
|
isValidated = isValidated && validateAccount(this);
|
||||||
});
|
});
|
||||||
@ -374,6 +380,18 @@ function validateDate() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the record.
|
||||||
|
*
|
||||||
|
* @param {HTMLLIElement} record the record
|
||||||
|
* @returns {boolean} true if the validation succeed, or false
|
||||||
|
* otherwise
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
function validateRecord(record) {
|
||||||
|
return !record.classList.contains("list-group-item-danger");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validates the account column.
|
* Validates the account column.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user