Skip to content
Snippets Groups Projects
Commit f670379e authored by Mathias Chouet's avatar Mathias Chouet Committed by mathias.chouet
Browse files

Fix bug: Alt+Enter triggers calculation even if form is invalid

parent 0510dca4
No related branches found
No related tags found
1 merge request!82Resolve "Ajout de la fonctionnalité "Respect des critères""
This commit is part of merge request !82. Comments created here will be created in the context of that merge request.
......@@ -445,49 +445,50 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe
private updateUIValidity() {
this._isUIValid = false;
if (! this._formulaire.calculateDisabled) {
if (this._fieldsetComponents !== undefined) {
this._isUIValid = this._fieldsetComponents.reduce(
// callback
(
// accumulator (valeur précédente du résultat)
acc,
// currentValue (élément courant dans le tableau)
fieldset,
// currentIndex (indice courant dans le tableau)
currIndex,
// array (tableau parcouru)
array
) => {
return acc && fieldset.isValid;
}
// valeur initiale
, this._fieldsetComponents.length > 0);
}
if (this._fieldsetContainerComponents !== undefined) {
this._isUIValid = this._isUIValid && this._fieldsetContainerComponents.reduce<boolean>(
// callback
(
// accumulator (valeur précédente du résultat)
acc,
// currentValue (élément courant dans le tableau)
fieldsetContainer,
// currentIndex (indice courant dans le tableau)
currIndex,
// array (tableau parcouru)
array
): boolean => {
return acc && fieldsetContainer.isValid;
}
// valeur initiale
, true);
}
if (this._pabTableComponent !== undefined) {
this._isUIValid = this._isUIValid && this._pabTableComponent.isValid;
// all fieldsets must be valid
if (this._fieldsetComponents !== undefined) {
this._isUIValid = this._fieldsetComponents.reduce(
// callback
(
// accumulator (valeur précédente du résultat)
acc,
// currentValue (élément courant dans le tableau)
fieldset,
// currentIndex (indice courant dans le tableau)
currIndex,
// array (tableau parcouru)
array
) => {
return acc && fieldset.isValid;
}
// valeur initiale
, this._fieldsetComponents.length > 0);
}
// all fieldset containers must be valid
if (this._fieldsetContainerComponents !== undefined) {
this._isUIValid = this._isUIValid && this._fieldsetContainerComponents.reduce<boolean>(
// callback
(
// accumulator (valeur précédente du résultat)
acc,
// currentValue (élément courant dans le tableau)
fieldsetContainer,
// currentIndex (indice courant dans le tableau)
currIndex,
// array (tableau parcouru)
array
): boolean => {
return acc && fieldsetContainer.isValid;
}
// valeur initiale
, true);
}
// special components must be valid
if (this._pabTableComponent !== undefined) {
this._isUIValid = this._isUIValid && this._pabTableComponent.isValid;
}
}
}
}
public getElementStyleDisplay(id: string) {
const isDisplayed: boolean = this._formulaire.isDisplayed(id);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment