if (checkbox.isSelected(0)) {
Context vcContext = ubcMan.getDemoContext(getTranslator(), isAdministrativeUser);
validChange = true;
FormItem formItem = formItems.get(i);
if (formItem instanceof TextElement) {
TextElement propertyField = (TextElement) formItem;
String inputFieldValue = propertyField.getValue();
// check validity of velocity-variables by using default values from
// userproperties
inputFieldValue = inputFieldValue.replace("$", "$!");
String evaluatedInputFieldValue = ubcMan.evaluateValueWithUserContext(inputFieldValue, vcContext);
// check user property configuration
for (UserPropertyHandler handler : userPropertyHandlers) {
if (handler.getName().equals(formItem.getName())) {
// first check on mandatoryness
if (um.isMandatoryUserProperty(usageIdentifyer, handler) && ! StringHelper.containsNonWhitespace(evaluatedInputFieldValue)) {
formItem.setErrorKey("form.name." + handler.getName() + ".error.empty", null);
return false;
}
// second check on property content
ValidationError valicationError = new ValidationError();
if (! handler.isValidValue(evaluatedInputFieldValue, valicationError, ureq.getLocale())) {
formItem.setErrorKey(valicationError.getErrorKey(), null);
return false;
}
// else validation was ok, reset previous errors
formItem.clearError();
}
}
// special case: check password-syntax:
if (propertyField.getName().equals("password")) {
if (!um.syntaxCheckOlatPassword(evaluatedInputFieldValue)) {
propertyField.setErrorKey("error.password", new String[] { evaluatedInputFieldValue });
return false;
}
}
// already done by form.visitAll -> validate():