Performs an initial validation of all form fields.<p>
427691
public void validateAllFields() {

        CmsValidationController validationController = new CmsValidationController(
            m_fields.values(),
            createValidationHandler());
        validationController.setFormValidator(m_validatorClass);
        validationController.setFormValidatorConfig(createValidatorConfig());
        startValidation(validationController);
    }
1215246
@Override
    public void validate() {
        if (value == null) {
            throw new NoValueGivenException(getPath());
        }

        if (valids.size() != 0) {
            boolean ok = false;
            String valString = (value != null) ? value.toString() : "";

            for (int i = 0; i < valids.size(); i++) {
                if (valids.get(i).equals(valString)) {
                    ok = true;
                    break;
                }
            }

            if (!ok) {
                throw new NoValidValueException(getPath(), valString);
            }
        }

        setValid(true);
    }
1256531
public void initializeButtons() {

        List<Element> editableElements = CmsDomUtil.getElementsByClass(CmsGwtConstants.CLASS_EDITABLE, Tag.div);
        List<CmsDirectEditButtons> editables = Lists.newArrayList();

        for (Element elem : editableElements) {
            CmsPositionBean pos = CmsDomUtil.getEditablePosition(elem);
            m_positions.put(elem.getId(), pos);
        }

        CmsEditablePositionCalculator posCalc = new CmsEditablePositionCalculator(m_positions);
        m_buttonPositions = posCalc.calculatePositions();

        for (Element elem : editableElements) {
            CmsDirectEditButtons directEdit = processEditableElement(elem);
            m_directEditButtons.put(elem.getId(), directEdit);
            editables.add(directEdit);
        }
        Window.addResizeHandler(new ResizeHandler() {

            public void onResize(ResizeEvent event) {

                repositionButtons();
            }
        });
    }
455473
protected void initUserObject() {

        if (m_fieldconfiguration == null) {
            try {
                m_fieldconfiguration = m_searchManager.getFieldConfiguration(getParamFieldconfiguration());
                if (m_fieldconfiguration == null) {
                    m_fieldconfiguration = new CmsLuceneFieldConfiguration();
                }
            } catch (Exception e) {
                m_fieldconfiguration = new CmsLuceneFieldConfiguration();
            }
        }
    }
1193134
public function validate() : void
    {
        if (null === $this->is_valid) {
            if (null === $this->user_value && null !== $this->default_value) {
                // There is a preset value, and its not being changed
                $this->is_valid = true;
            } elseif (true == $this->user_value || 1 == $this->user_value) {
                $this->user_value = 1;
                $this->is_valid = true;
            } elseif (false == $this->user_value || 0 == $this->user_value || '' == $this->user_value) {
                $this->user_value = 0;
                $this->is_valid = true;
            } elseif (false == $this->validator) {
                // This field does not get validated
                $this->is_valid = true;
            } else {
                $this->is_valid = false;
                $this->error = 'The provided value is not valid. Please enter a valid value.';
            }
        }

        // Check if the input is different from the default value
        if ($this->is_valid && null !== $this->user_value) {
            $this->is_changed = ($this->default_value != $this->user_value);
        }
    }
1191094
protected void addValidators() {

        //Target file ComboBox
        m_target.removeAllValidators();
        m_target.addValidator(new TargetValidator());

        for (I_CmsEditableGroupRow row : m_resourcesGroup.getRows()) {
            FormLayout layout = (FormLayout)(row.getComponent());
            CmsPathSelectField field = (CmsPathSelectField)layout.getComponent(0);
            field.removeAllValidators();
            field.addValidator(new ResourceValidator());
        }
    }
1277855
protected function InitForm()
    {
        $this->submit = $this->LoadElement();
        
        $this->AddNameField();
        $this->AddValueField();
        
        $this->AddCssIDField();
        $this->AddCssClassField();
        $this->AddTemplateField();
        $this->AddSubmit();
    }
439283
void submitForm(CmsForm formParam, final Map<String, String> fieldValues, Set<String> editedFields) {

        String modelGroupId = null;

        if (CmsInheritanceContainerEditor.getInstance() != null) {
            CmsInheritanceContainerEditor.getInstance().onSettingsEdited();
        }
        if (m_contextsWidget != null) {
            String newTemplateContexts = m_contextsWidget.getFormValueAsString();
            if ((newTemplateContexts == null) || "".equals(newTemplateContexts)) {
                newTemplateContexts = CmsTemplateContextInfo.EMPTY_VALUE;
                // translate an empty selection to "none"
            }
            fieldValues.put(CmsTemplateContextInfo.SETTING, newTemplateContexts);
        }
        final boolean hasFormatterChanges;
        if (m_formatterSelect != null) {
            fieldValues.put(
                CmsFormatterConfig.getSettingsKeyForContainer(m_containerId),
                m_formatterSelect.getFormValueAsString());
            hasFormatterChanges = true;
        } else {
            hasFormatterChanges = false;
        }
        if (m_createNewCheckBox != null) {
            m_elementWidget.setCreateNew(m_createNewCheckBox.isChecked());
            fieldValues.put(CmsContainerElement.CREATE_AS_NEW, Boolean.toString(m_createNewCheckBox.isChecked()));
        }
        if (m_modelGroupSelect != null) {
            GroupOption group = GroupOption.valueOf(m_modelGroupSelect.getFormValueAsString());
            switch (group) {
                case disabled:
                    fieldValues.put(CmsContainerElement.MODEL_GROUP_STATE, ModelGroupState.noGroup.name());
                    fieldValues.put(CmsContainerElement.USE_AS_COPY_MODEL, Boolean.toString(false));
                    break;
                case copy:
                    fieldValues.put(CmsContainerElement.MODEL_GROUP_STATE, ModelGroupState.isModelGroup.name());
                    fieldValues.put(CmsContainerElement.USE_AS_COPY_MODEL, Boolean.toString(true));
                    break;
                case reuse:
                    fieldValues.put(CmsContainerElement.MODEL_GROUP_STATE, ModelGroupState.isModelGroup.name());
                    fieldValues.put(CmsContainerElement.USE_AS_COPY_MODEL, Boolean.toString(false));
                    break;
                default:
                    break;
            }
            if (group != GroupOption.disabled) {
                modelGroupId = CmsContainerpageController.getServerId(m_elementBean.getClientId());
            }
        }

        if ((m_modelGroupBreakUp != null) && m_modelGroupBreakUp.isChecked()) {
            fieldValues.put(CmsContainerElement.MODEL_GROUP_STATE, ModelGroupState.noGroup.name());
        }

        final Map<String, String> filteredFieldValues = new HashMap<String, String>();
        for (Map.Entry<String, String> entry : fieldValues.entrySet()) {
            String key = entry.getKey();
            String value = entry.getValue();
            if ((value != null) && (value.length() > 0)) {
                filteredFieldValues.put(key, value);
            }
        }
        final String changeModelGroupId = modelGroupId;
        m_controller.reloadElementWithSettings(
            m_elementWidget,
            m_elementBean.getClientId(),
            filteredFieldValues,
            new I_CmsSimpleCallback<CmsContainerPageElementPanel>() {

                public void execute(CmsContainerPageElementPanel result) {

                    if (isTemplateContextChanged()) {
                        // if the context multiselect box isn't displayed, of course it can't change values,
                        // and this code won't be executed.
                        CmsContainerpageController.get().handleChangeTemplateContext(
                            result,
                            filteredFieldValues.get(CmsTemplateContextInfo.SETTING));
                    }
                    if (hasFormatterChanges) {
                        updateCss();
                    }
                    if (result.getElement().getInnerHTML().contains(CmsGwtConstants.FORMATTER_RELOAD_MARKER)
                        && !CmsContainerpageController.get().isGroupcontainerEditing()) {
                        CmsContainerpageController.get().reloadPage();
                    }
                    if (m_modelGroupSelect != null) {
                        m_controller.setModelGroupElementId(changeModelGroupId);
                    }
                }

            });
    }
874250
@SuppressWarnings("unchecked")
    protected void validate() {

        if (m_ou == null) {
            m_name.removeAllValidators();
            m_name.addValidator(new NameValidator());
        }
        m_description.setRequired(true);
        m_description.setRequiredError("Required");

        if (m_ouResources.getRows().isEmpty() & !m_webuser.getValue().booleanValue()) {
            CmsPathSelectField field = new CmsPathSelectField();
            field.setUseRootPaths(true);
            field.setCmsObject(m_cms);
            m_ouResources.addRow(field);
        }
        for (I_CmsEditableGroupRow row : m_ouResources.getRows()) {
            ((AbstractField<String>)row.getComponent()).removeAllValidators();
            ((AbstractField<String>)row.getComponent()).addValidator(new ResourceValidator());
        }
    }
405217
private void startAsyncValidation() {

        CmsRpcAction<Map<String, CmsValidationResult>> action = new CmsRpcAction<Map<String, CmsValidationResult>>() {

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
             */
            @Override
            public void execute() {

                start(0, false);
                CmsCoreProvider.getService().validate(m_validationQueries, this);
            }

            @Override
            public void onFailure(Throwable e) {

                super.onFailure(e);
                CmsValidationScheduler.get().executeNext();

            }

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
             */
            @Override
            protected void onResponse(Map<String, CmsValidationResult> result) {

                stop(false);
                onReceiveValidationResults(result);
            }

        };
        action.execute();
    }
91915
protected void initializeForm() {

        String target = CmsSitemapView.getInstance().getController().getData().getAliasImportUrl();
        m_formPanel.setAction(target);
        m_formPanel.setMethod(FormPanel.METHOD_POST);
        m_formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
        Hidden siteRootField = new Hidden(I_CmsAliasConstants.PARAM_SITEROOT);
        siteRootField.setValue(CmsCoreProvider.get().getSiteRoot());
        m_formPanelContents.add(siteRootField);
        m_formPanelContents.add(m_separatorField);
        m_formPanel.addSubmitCompleteHandler(new SubmitCompleteHandler() {

            public void onSubmitComplete(SubmitCompleteEvent event) {

                final String formPostResults = event.getResults();
                final I_CmsSitemapServiceAsync service = CmsSitemapView.getInstance().getController().getService();
                CmsRpcAction<List<CmsAliasImportResult>> action = new CmsRpcAction<List<CmsAliasImportResult>>() {

                    @Override
                    public void execute() {

                        start(200, false);
                        service.getAliasImportResult(formPostResults.trim(), this);
                    }

                    @Override
                    public void onResponse(List<CmsAliasImportResult> result) {

                        stop(false);
                        handleImportResults(result);
                        Timer resizeTimer = new Timer() {

                            @Override
                            public void run() {

                                m_scrollPanel.onResizeDescendant();
                            }
                        };
                        resizeTimer.schedule(100);
                    }
                };
                action.execute();
            }
        });
    }
1051594
function validateFields(contentType, cb) {
        if (_.isArray(contentType.fields)) {
            async.each(contentType.fields, validateField, function(err) {
                cb(err);
            });
        } else {
            cb();
        }
    }
907993
function validateField(fieldId, submission, sectionIndex, cb) {
      init();

      if (_.isFunction(sectionIndex)) {
        cb = sectionIndex;
        sectionIndex = 0;
      }

      var err = initSubmission(submission);
      if (err) {
        return cb(err);
      }

      var submissionField = submissionFieldsMap[fieldId][sectionIndex];
      var fieldDef = fieldMap[fieldId];

      getFieldValidationStatus(submissionField, fieldDef, null, function(err, res) {
        if (err) {
          return cb(err);
        }
        var ret = {
          validation: {}
        };

        assignValidationResponse(fieldId, sectionIndex, ret.validation, res);
        return cb(undefined, ret);
      });
    }
697427
@SuppressWarnings("unchecked")
	private static ValidationFail performFieldValidations(Context context, FieldInfo fieldInfo, View view) {
		// first, we need to check if condition is not applied for all validations on field
		if (fieldInfo.condition != null && fieldInfo.condition.validationAnnotation().equals(Condition.class)) {
			// condition is applied to all validations on field
			boolean evaluation = evaluateCondition(view, fieldInfo.condition);
			if (! evaluation) {
				// go to next field
				return null;
			}
		}

		// field validations
		for (ValidationInfo valInfo : fieldInfo.validationInfoList) {
			final Annotation annotation = valInfo.annotation;
			if (fieldInfo.condition != null && fieldInfo.condition.validationAnnotation().equals(annotation.annotationType())) {
				boolean evaluation = evaluateCondition(view, fieldInfo.condition);

				if (! evaluation) {
					// continue to next annotation
					continue;
				}
			}
			final IFieldAdapter adapter = FieldAdapterFactory.getAdapterForField(view, annotation);
			if (adapter == null) {
				throw new NoFieldAdapterException(view, annotation);
			}

			final Object value = adapter.getFieldValue(annotation, view);
			final boolean isValid = valInfo.validator.validate(annotation, value);

			if (! isValid) {
				final String message = valInfo.validator.getMessage(context, annotation, value);
				final int order = valInfo.validator.getOrder(annotation);

				// no more validations on this field
				return new ValidationFail(view, message, order);
			}
		}
		return null;
	}
762765
private void initFields() {

        CmsObject cms = A_CmsUI.getCmsObject();
        boolean online = cms.getRequestContext().getCurrentProject().isOnlineProject();

        if (m_searchPattern.getValue().isEmpty()) {
            m_searchPattern.setValue(REGEX_ALL);
        }
        m_resourceSearch.setUseRootPaths(true);
        m_replaceResource.setUseRootPaths(true);
        m_resourceSearch.requireFile();
        m_replaceResource.requireFile();
        CmsObject rootCms;
        try {
            rootCms = OpenCms.initCmsObject(cms);

            rootCms.getRequestContext().setSiteRoot("");
            m_resourceSearch.setCmsObject(rootCms);
            m_resourceSearch.setDefaultPath(cms.getRequestContext().getSiteRoot());
            m_replaceResource.setCmsObject(rootCms);
            m_replaceResource.setDefaultPath(cms.getRequestContext().getSiteRoot());

        } catch (CmsException e1) {
            //
        }
        m_siteSelect.setContainerDataSource(
            CmsVaadinUtils.getAvailableSitesContainer(cms, CmsVaadinUtils.PROPERTY_LABEL));
        m_siteSelect.setItemCaptionPropertyId(CmsVaadinUtils.PROPERTY_LABEL);
        m_siteSelect.setTextInputAllowed(true);
        m_siteSelect.setNullSelectionAllowed(false);
        m_siteSelect.setFilteringMode(FilteringMode.CONTAINS);
        m_siteSelect.setValue(cms.getRequestContext().getSiteRoot());
        try {
            for (CmsPropertyDefinition prop : A_CmsUI.getCmsObject().readAllPropertyDefinitions()) {
                m_property.addItem(prop);
                m_property.setItemCaption(prop, prop.getName());
            }
        } catch (CmsException e) {
            //
        }
        m_siteSelect.addValueChangeListener(new ValueChangeListener() {

            private static final long serialVersionUID = -1079794209679015125L;

            public void valueChange(ValueChangeEvent event) {

                try {
                    updateSearchRoot();
                } catch (CmsException e) {
                    LOG.error("Unable to initialize CmsObject", e);
                }
            }

        });
        m_property.setNullSelectionAllowed(false);
        m_property.select(m_property.getItemIds().iterator().next());
        m_property.setFilteringMode(FilteringMode.CONTAINS);
        m_searchType.setFilteringMode(FilteringMode.OFF);
        m_searchType.setNullSelectionAllowed(false);
        m_searchType.addItem(SearchType.fullText);
        m_searchType.setItemCaption(
            SearchType.fullText,
            CmsVaadinUtils.getMessageText(Messages.GUI_SOURCESEARCH_SERACH_TYPE_FULLTEXT_0));
        m_searchType.addItem(SearchType.contentValues);
        m_searchType.setItemCaption(
            SearchType.contentValues,
            CmsVaadinUtils.getMessageText(Messages.GUI_SOURCESEARCH_SERACH_TYPE_XMLCONTENT_0));
        m_searchType.addItem(SearchType.properties);
        m_searchType.setItemCaption(
            SearchType.properties,
            CmsVaadinUtils.getMessageText(Messages.GUI_SOURCESEARCH_PROPERTY_SEARCH_0));
        m_searchType.addItem(SearchType.resourcetype);
        m_searchType.setItemCaption(
            SearchType.resourcetype,
            CmsVaadinUtils.getMessageText(Messages.GUI_SOURCESEARCH_RESOURCE_SEARCH_0));
        m_searchType.addItem(SearchType.renameContainer);
        m_searchType.setItemCaption(
            SearchType.renameContainer,
            CmsVaadinUtils.getMessageText(Messages.GUI_SOURCESEARCH_RENAME_CONTAINER_SEARCH_0));
        if (OpenCms.getSearchManager().getSolrServerConfiguration().isEnabled()) {

            m_searchIndex.setFilteringMode(FilteringMode.OFF);
            m_searchIndex.setNullSelectionAllowed(false);
            String selectIndex = null;
            for (CmsSearchIndex index : OpenCms.getSearchManager().getAllSolrIndexes()) {
                boolean offlineMode = I_CmsSearchIndex.REBUILD_MODE_OFFLINE.equals(index.getRebuildMode());
                // in case the current project is offline, show offline indexes, otherwise show online indexes
                if ((!online && offlineMode) || (online && !offlineMode)) {
                    m_searchIndex.addItem(index.getName());
                    if (selectIndex == null) {
                        selectIndex = index.getName();
                    }
                }
            }
            if (selectIndex != null) {
                m_searchIndex.setValue(selectIndex);

                // only add the solr search types if there is an index available
                m_searchType.addItem(SearchType.solr);
                m_searchType.setItemCaption(
                    SearchType.solr,
                    CmsVaadinUtils.getMessageText(Messages.GUI_SOURCESEARCH_SERACH_TYPE_SOLR_0));
                m_searchType.addItem(SearchType.solrContentValues);
                m_searchType.setItemCaption(
                    SearchType.solrContentValues,
                    CmsVaadinUtils.getMessageText(Messages.GUI_SOURCESEARCH_SERACH_TYPE_SOLR_CONTENT_VALUES_0));

            }
        }
        m_searchType.setValue(SearchType.fullText);

        m_searchRoot.setValue("/");
        m_searchRoot.disableSiteSwitch();
        m_searchRoot.setResourceFilter(CmsResourceFilter.DEFAULT_FOLDERS);
        m_searchRoot.requireFolder();
        m_locale.setFilteringMode(FilteringMode.OFF);
        for (Locale locale : OpenCms.getLocaleManager().getAvailableLocales()) {
            m_locale.addItem(locale);
        }

        m_resourceType.setNullSelectionAllowed(true);
        IndexedContainer resTypes = CmsVaadinUtils.getResourceTypesContainer();
        resTypes.addContainerFilter(CmsVaadinUtils.FILTER_NO_FOLDERS);

        m_resourceType.setContainerDataSource(resTypes);
        m_resourceType.setItemCaptionPropertyId(PropertyId.caption);
        m_resourceType.setItemIconPropertyId(PropertyId.icon);
        m_resourceType.setFilteringMode(FilteringMode.CONTAINS);

        m_workProject.setNullSelectionAllowed(false);
        IndexedContainer projects = CmsVaadinUtils.getProjectsContainer(A_CmsUI.getCmsObject(), "caption");
        projects.removeItem(CmsProject.ONLINE_PROJECT_ID);
        m_workProject.setContainerDataSource(projects);
        m_workProject.setItemCaptionPropertyId("caption");

        if (online) {
            m_replace.setEnabled(false);
        } else {
            m_workProject.setValue(cms.getRequestContext().getCurrentProject().getUuid());
        }
    }
330386
public function validate(): void
    {
        $this->validateRootFilter();
        $this->validateRelations();
        $this->validateSorts();
        $this->validateOffset();
        $this->validateLimit();
        $this->validateFields();
    }
137567
public boolean validateAllFields() {
        boolean cardNumberIsValid =
                CardUtils.isValidCardNumber(mCardNumberEditText.getCardNumber());
        boolean expiryIsValid = mExpiryDateEditText.getValidDateFields() != null &&
                mExpiryDateEditText.isDateValid();
        boolean cvcIsValid = isCvcLengthValid();
        mCardNumberEditText.setShouldShowError(!cardNumberIsValid);
        mExpiryDateEditText.setShouldShowError(!expiryIsValid);
        mCvcEditText.setShouldShowError(!cvcIsValid);
        boolean postalCodeIsValidOrGone;
        if (mShouldShowPostalCode) {
            postalCodeIsValidOrGone = isPostalCodeMaximalLength(true,
                    mPostalCodeEditText.getText().toString());
            mPostalCodeEditText.setShouldShowError(!postalCodeIsValidOrGone);
        } else {
            postalCodeIsValidOrGone = true;
        }

        return cardNumberIsValid
                && expiryIsValid
                && cvcIsValid
                && postalCodeIsValidOrGone;
    }