FormCollectionView.prototype.onSubmit = function (event) { //clear old errors this.clearErrors(); //check that all instances of InputCollectionModel are valid var errors = new Lavender.ArrayList(); for (var i = 0; i < this.collection.length; i++) { if (!this.collection.getItemAt(i).isValid) { errors.addAll(this.collection.getItemAt(i).errors.source()); } } //display any validation errors if (errors.length > 0) { this.addErrors(errors); if (this.validationWarning) { this.validationWarning.style.display = this._validationWarningDisplay; } if (this.error) { this.error.style.display = this._errorDisplay; } } else { this.state = FormCollectionView.SUBMIT; if (this.validationWarning) { this.validationWarning.style.display = 'none'; } if (this.error) { this.error.style.display = 'none'; } } };
TextInputValidator.prototype.getValidationErrors = function () { var returnList = new Lavender.ArrayList(); for (var i = 0; i < this.source.collection.length; i++) { var item = this.source.collection.getItemAt(i); if (item.required && (!item.nonFormattedValue || item.nonFormattedValue.length <= 0)) { returnList.addItem(new ValidationError_1.ValidationError('required', 'form.required', item.label + ' is required')); } } return returnList; //returns ArrayList of SpiSdk.ValidationError instances };
SelectableInputValidator.prototype.getValidationErrors = function () { var returnList = new Lavender.ArrayList(); //if the model requires a selection ensure there is one if (this.source.selectionRequired) { var itemSelected = false; var groupName = void 0; for (var i = 0; i < this.source.collection.length; i++) { groupName = this.source.collection.getItemAt(i).name; //group name is the same for all items if (this.source.collection.getItemAt(i).selected) { itemSelected = true; break; } } //at least one item must be selected if (!itemSelected) { returnList.addItem(new ValidationError_1.ValidationError('selected', 'form.selectionRequired', groupName + ' must have a selection.')); } } return returnList; //returns ArrayList of SpiSdk.ValidationError instances };