ReAdded a lastErroredInput to get the last error

This commit is contained in:
Florian Bouillon 2019-10-08 17:35:05 +02:00
parent b2c238ea13
commit bb85279818
No known key found for this signature in database
GPG Key ID: B143FF27EF555D16

View File

@ -127,6 +127,15 @@ export default class FormManager {
*/
private FMInputs: FMAssignInterface[] = []
/**
* The last verified `FMInput` that returned an error
*
* @type {FMInput}
* @memberof FormManager
*/
public lastErroredInput: FMInput
private _form: HTMLFormElement
/**
* The Form Element of the FM
@ -229,9 +238,13 @@ export default class FormManager {
for (const name in this.inputs) {
if (this.inputs.hasOwnProperty(name)) {
const input = this.inputs[name];
if(!input.verify()) return false
if(!input.verify()) {
this.lastErroredInput = input
return false
}
}
}
this.lastErroredInput = undefined
return true
}