Fixed the JavaScript form validation logic from isValid && validateXxx() to validateXxx() && isValid, in order to correctly validate multiple fields at once.
This commit is contained in:
parent
62b59e7380
commit
a0382ad179
@ -97,8 +97,8 @@ function updateParent(code) {
|
||||
*/
|
||||
function validateForm() {
|
||||
let isValid = true;
|
||||
isValid = isValid && validateCode();
|
||||
isValid = isValid && validateTitle();
|
||||
isValid = validateCode() && isValid;
|
||||
isValid = validateTitle() && isValid;
|
||||
return isValid;
|
||||
}
|
||||
|
||||
|
@ -338,26 +338,26 @@ function resetRecordButtons() {
|
||||
*/
|
||||
function validateForm() {
|
||||
let isValid = true;
|
||||
isValid = isValid && validateDate();
|
||||
isValid = validateDate() && isValid;
|
||||
$(".debit-record").each(function () {
|
||||
isValid = isValid && validateRecord(this);
|
||||
isValid = validateRecord(this) && isValid;
|
||||
});
|
||||
$(".credit-account").each(function () {
|
||||
isValid = isValid && validateRecord(this);
|
||||
isValid = validateRecord(this) && isValid;
|
||||
});
|
||||
$(".record-account").each(function () {
|
||||
isValid = isValid && validateAccount(this);
|
||||
isValid = validateAccount(this) && isValid;
|
||||
});
|
||||
$(".record-summary").each(function () {
|
||||
isValid = isValid && validateSummary(this);
|
||||
isValid = validateSummary(this) && isValid;
|
||||
});
|
||||
$(".record-amount").each(function () {
|
||||
isValid = isValid && validateAmount(this);
|
||||
isValid = validateAmount(this) && isValid;
|
||||
});
|
||||
if (isTransfer()) {
|
||||
isValid = isValid && validateBalance();
|
||||
isValid = validateBalance() && isValid;
|
||||
}
|
||||
isValid = isValid && validateNote();
|
||||
isValid = validateNote() && isValid;
|
||||
return isValid;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user