Package org.olat.core.gui.components.form

Examples of org.olat.core.gui.components.form.ValidationError


    this.itemValidatorProvider = itemValidatorProvider;
  }
 
  private boolean checkItemValidatorIsValid (){
    Locale locale = getTranslator().getLocale();
    ValidationError validationErrorCallback = new ValidationError();
    boolean isValid = itemValidatorProvider.isValidValue(value, validationErrorCallback, locale);
    if (isValid) return true;
    else {
      setErrorKey(validationErrorCallback.getErrorKey(), null);
      return false;
    }
  }
View Full Code Here


                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();
              }
View Full Code Here

                textAreaElement.setErrorKey("error.mandatory", new String[] { String.valueOf(i + 1), translate(userPropertyHandler.i18nFormElementLabelKey()) });
                importDataError = true;
                break;
              }
              // used for call-back value depending on PropertyHandler
              ValidationError validationError = new ValidationError();
              if (!userPropertyHandler.isValidValue(thisValue, validationError, getLocale())) {
                textAreaElement.setErrorKey("error.lengthorformat", new String[] { String.valueOf(i + 1), translate(userPropertyHandler.i18nFormElementLabelKey()),
                    translate(validationError.getErrorKey()) });
                importDataError = true;
                break;
              }
              // check that no user with same email is already in list
              if (thisKey.equals(UserConstants.EMAIL)) {
View Full Code Here

          inputFieldValue = attributeChangeMap.get(propertyName);
          inputFieldValue = inputFieldValue.replace("$", "$!");
          String evaluatedInputFieldValue = evaluateValueWithUserContext(inputFieldValue, vcContext)
         
          // validate evaluated property-value
          ValidationError validationError = new ValidationError();
          // do validation checks with users current locale!
          Locale locale = transWithFallback.getLocale();
          if (!propHandler.isValidValue(evaluatedInputFieldValue, validationError, locale)) {
            errorDesc = transWithFallback.translate(validationError.getErrorKey()) + " (" + evaluatedInputFieldValue + ")";
            updateError = true;
            break;
          }

          if (!evaluatedInputFieldValue.equals(userValue)) {
View Full Code Here

  public boolean isValid(FormItem formItem, Map formContext) {
    // check parent rules first: check if mandatory and empty
    if ( ! super.isValid(formItem, formContext)) return false;
    org.olat.core.gui.components.form.flexible.elements.TextElement uiEl = (org.olat.core.gui.components.form.flexible.elements.TextElement) formItem;
    String value = uiEl.getValue();
    ValidationError validationError = new ValidationError();
    boolean valid = isValidValue(value, validationError, formItem.getTranslator().getLocale());
    if(!valid) {
      uiEl.setErrorKey(validationError.getErrorKey(), new String[]{});
    }
    return valid; 
  }
View Full Code Here

TOP

Related Classes of org.olat.core.gui.components.form.ValidationError

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.