update the message in the validation template when a validation error changes on an input control newValue is either a string or null (null when no bound entity)
426814
function valErrsChanged(newValue) {

                    // HTML5 custom validity
                    // http://dev.w3.org/html5/spec-preview/constraints.html#the-constraint-validation-api
                    if (domEl.setCustomValidity) {
                        /* only works in HTML 5. Maybe should throw if not available. */
                        domEl.setCustomValidity(newValue || '');
                    }

                    var errorHtml = newValue ? valTemplate.replace(/%error%/, newValue) : "";
                    var isRequired = info.getIsRequired();
                    var requiredHtml = isRequired ? requiredTemplate : '';
                    decorator.innerHTML = (isRequired || !!errorHtml) ? requiredHtml + errorHtml : "";
                }
1054436
protected void validateRequiredString(String field, String errorKey, String errorMessage) {
		if (StrKit.isBlank(controller.getPara(field))) {
			addError(errorKey, errorMessage);
		}
	}
1162760
function throwErrorIfNoChangesMode(creationMode, checkNoChangesMode, oldValue, currValue) {
    if (checkNoChangesMode) {
        var msg = "ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '" + oldValue + "'. Current value: '" + currValue + "'.";
        if (creationMode) {
            msg +=
                " It seems like the view has been created after its parent and its children have been dirty checked." +
                    " Has it been created in a change detection hook ?";
        }
        // TODO: include debug context
        throw new Error(msg);
    }
}
262250
protected boolean validateRequired(final FacesContext context, final Object newValue) {
        // If our value is valid, enforce the required property if present
        if (isValid() && isRequired() && isEmpty(newValue)) {
            final String requiredMessageStr = getRequiredMessage();
            FacesMessage message;
            if (null != requiredMessageStr) {
                message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
                            requiredMessageStr,
                            requiredMessageStr);
            }
            else {
                message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
                            MESSAGE_REQUIRED,
                            MESSAGE_REQUIRED);
            }
            context.addMessage(getClientId(context), message);
            final Sheet sheet = getSheet();
            if (sheet != null) {
                sheet.getInvalidUpdates().add(
                            new SheetInvalidUpdate(sheet.getRowKeyValue(context), sheet.getColumns().indexOf(this), this, newValue,
                                        message.getDetail()));
            }
            setValid(false);
            return false;
        }
        return true;
    }
537947
public void addRequiredAttributeValueError(final String val) throws ValidationException
    {
        addError(StringFormatter.format(MessageConstants.MESSAGES.attributeValueMustBeFixed(), val));
    }
1369948
private void validateElementProperty(String propertyName, String controlValue, String resultValue, TestContext context) {
        if (StringUtils.hasText(controlValue)) {
            String control = context.replaceDynamicContentInString(controlValue);

            if (ValidationMatcherUtils.isValidationMatcherExpression(control)) {
                ValidationMatcherUtils.resolveValidationMatcher("payload", resultValue, control, context);
            } else {
                Assert.isTrue(control.equals(resultValue), String.format("Selenium web element validation failed, %s expected '%s', but was '%s'", propertyName, control, resultValue));
            }
        }
    }
83657
private void checkPrimitiveBinding(List<ValidationMessage> errors, String path, String type, ElementDefinition elementContext, WrapperElement element) {
    if (!element.hasAttribute("value"))
      return;

    String value = element.getAttribute("value");
    // System.out.println("check "+value+" in "+path);

    // firstly, resolve the value set
    ElementDefinitionBindingComponent binding = elementContext.getBinding();
    if (binding.hasValueSet() && binding.getValueSet() instanceof Reference) {
      ValueSet vs = resolveBindingReference(binding.getValueSet());
      if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, vs != null, "ValueSet {0} not found", describeReference(binding.getValueSet()))) {
        ValidationResult vr = context.validateCode(null, value, null, vs);
      	if (!vr.isOk()) {
      		if (binding.getStrength() == BindingStrength.REQUIRED)
      			warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided is not in the value set " + describeReference(binding.getValueSet()) + " (" + vs.getUrl() + ", and a code is required from this value set)");
      		else if (binding.getStrength() == BindingStrength.EXTENSIBLE)
      			warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided is not in the value set " + describeReference(binding.getValueSet()) + " (" + vs.getUrl() + ", and a code should come from this value set unless it has no suitable code)");
      		else if (binding.getStrength() == BindingStrength.PREFERRED)
      			hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false,  "The value provided is not in the value set " + describeReference(binding.getValueSet()) + " (" + vs.getUrl() + ", and a code is recommended to come from this value set)");
      	}
      }
    } else
      hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Binding has no source, so can't be checked");
  }
1355239
public static <T> T validateNotNull(T value, String errorMsgTemplate, Object... params) throws ValidateException {
		if (isNull(value)) {
			throw new ValidateException(errorMsgTemplate, params);
		}
		return value;
	}
50433
public static void addBindingUpdateError( ServletRequest request, String expression, String message, Throwable cause )
    {
        Map errors = ( Map ) request.getAttribute( BINDING_UPDATE_ERRORS_ATTR );

        if ( errors == null )
        {
            errors = new LinkedHashMap();
            request.setAttribute( BINDING_UPDATE_ERRORS_ATTR, errors );
        }

        errors.put( expression, new BindingUpdateError( expression, message, cause ) );
    }
933727
@SuppressWarnings({"rawtypes", "unchecked"})
    private void initializeFormFieldWidget(final I_CmsFormField formField) {

        final I_CmsFormWidget widget = formField.getWidget();
        if (widget instanceof HasValueChangeHandlers) {
            ((HasValueChangeHandlers)widget).addValueChangeHandler(new ValueChangeHandler() {

                /**
                 * @see com.google.gwt.event.logical.shared.ValueChangeHandler#onValueChange(ValueChangeEvent event)
                 */
                public void onValueChange(ValueChangeEvent event) {

                    boolean inhibitValidation = false;
                    if (event instanceof CmsExtendedValueChangeEvent) {
                        CmsExtendedValueChangeEvent extEvent = (CmsExtendedValueChangeEvent)event;
                        inhibitValidation = extEvent.isInhibitValidation();
                    }
                    Object eventValue = event.getValue();
                    if ((eventValue instanceof String) || (event.getValue() == null)) {
                        // only makes sense for strings
                        defaultHandleValueChange(formField, (String)(event.getValue()), inhibitValidation);
                    } else if (eventValue instanceof Date) {
                        defaultHandleValueChange(formField, "" + ((Date)eventValue).getTime(), inhibitValidation);
                    } else if (eventValue instanceof Boolean) {
                        defaultHandleValueChange(formField, "" + eventValue, inhibitValidation);
                    }

                }
            });
        }

        if (widget instanceof HasKeyPressHandlers) {
            ((HasKeyPressHandlers)widget).addKeyPressHandler(new KeyPressHandler() {

                /**
                 * @see com.google.gwt.event.dom.client.KeyPressHandler#onKeyPress(com.google.gwt.event.dom.client.KeyPressEvent)
                 */
                public void onKeyPress(KeyPressEvent event) {

                    int keyCode = event.getNativeEvent().getKeyCode();
                    defaultHandleKeyPress(formField, keyCode);
                }
            });
        }
    }
959646
protected void updateFieldValidationStatus(I_CmsFormField field, CmsValidationResult result) {

        if (result.hasNewValue()) {
            if (field.getModel() != null) {
                field.getModel().setValue(result.getNewValue(), true);
            }
            field.getWidget().setFormValueAsString(result.getNewValue());
        }
        String errorMessage = result.getErrorMessage();
        field.getWidget().setErrorMessage(result.getErrorMessage());
        field.setValidationStatus(
            errorMessage == null ? I_CmsFormField.ValidationStatus.valid : I_CmsFormField.ValidationStatus.invalid);
    }
1232191
private void updateFromTextBox(boolean initial) {

        Date date = getValue();
        if (initial && (date == null)) {
            date = m_initialDate;
        }
        setPickerValue(date, false);
        m_time.setErrorMessage(null);
        fireChange(getValue(), false);
    }
574811
function (name, value, oldValue) {
                this.$InputElement.onbind.apply(this, arguments);
                if (name === "value") {
                    value = (value != null) ? value + "" : "";
                    if (value) {
                        this._removePlaceholder();
                    }
                    this._domElt.value = value;
                    this._setPlaceholder();
                }
            }
349060
function () {
            this._hasFocus = false;
            this._updateState();
            if (this._cfg.formatError && this._cfg.validationEvent === 'onBlur') {// show
                // errortip on blur used for debug purposes
                this._validationPopupShow();
            } else { // dispose of error tip
                this._validationPopupHide();
                if (this._cfg.directOnBlurValidation) {
                    if (this._cfg.bind) {
                        var bind = this._cfg.bind.value;
                        if (bind) {
                            var dataholder = bind.inside;
                            var name = bind.to;
                            var groups = this._cfg.validationGroups;
                            aria.utils.Data.validateValue(dataholder, name, null, groups, 'onblur');
                        }
                    }
                }
            }
            this._updateValue(true);
            // _updateValue can change the value in the data model, which could make the widget be disposed
            // (for example during a refresh of a section bound to that part of the data model)
            // That's why we are checking if this._cfg is defined here:
            var onblur = this._cfg ? this._cfg.onblur : null;
            if (onblur) {
                this.evalCallback(onblur);
            }
        }
1140463
private void updateErrors() {
		boolean oldErrors = hasErrors;
		hasErrors = false;
		if (validationResults.getHasErrors()) {
			hasErrors = true;
		}
		else {
			Iterator childIter = children.iterator();
			while (childIter.hasNext()) {
				ValidationResultsModel childModel = (ValidationResultsModel) childIter.next();
				if (childModel.getHasErrors()) {
					hasErrors = true;
					break;
				}
			}
		}
		firePropertyChange(HAS_ERRORS_PROPERTY, oldErrors, hasErrors);
	}
657673
function expressionChangedAfterItHasBeenCheckedError(context, oldValue, currValue, isFirstCheck) {
    var msg = "ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '" + oldValue + "'. Current value: '" + currValue + "'.";
    if (isFirstCheck) {
        msg +=
            " It seems like the view has been created after its parent and its children have been dirty checked." +
                " Has it been created in a change detection hook ?";
    }
    return viewDebugError(msg, context);
}
937276
public void handleChangeTemplateContext(final CmsContainerPageElementPanel element, final String newValue) {

        if (CmsStringUtil.isEmptyOrWhitespaceOnly(newValue) || CmsTemplateContextInfo.EMPTY_VALUE.equals(newValue)) {
            if (CmsInheritanceContainerEditor.getInstance() != null) {
                CmsInheritanceContainerEditor.getInstance().removeElement(element);
            } else {
                removeElement(element, ElementRemoveMode.silent);
            }
        }
    }