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:
@ -338,6 +338,12 @@ function resetRecordButtons() {
|
||||
function validateForm() {
|
||||
let isValidated = true;
|
||||
isValidated = isValidated && validateDate();
|
||||
$(".debit-record").each(function () {
|
||||
isValidated = isValidated && validateRecord(this);
|
||||
});
|
||||
$(".credit-account").each(function () {
|
||||
isValidated = isValidated && validateRecord(this);
|
||||
});
|
||||
$(".record-account").each(function () {
|
||||
isValidated = isValidated && validateAccount(this);
|
||||
});
|
||||
@ -374,6 +380,18 @@ function validateDate() {
|
||||
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.
|
||||
*
|
||||
|
Reference in New Issue
Block a user