Class CmsValidationController
java.lang.Object
org.opencms.gwt.client.validation.CmsValidationController
- All Implemented Interfaces:
I_CmsValidationController
This class is responsible for coordinating the synchronous and asynchronous validation for
a set of form fields.
- Since:
- 8.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Collection<I_CmsFormField>
The list of form fields which should be validated.A map containing all validation queries which should be executed asynchronously. -
Constructor Summary
ConstructorsConstructorDescriptionCmsValidationController
(Collection<I_CmsFormField> fields, I_CmsValidationHandler handler) Creates a new validation controller for a list of form fields.CmsValidationController
(I_CmsFormField field, I_CmsValidationHandler handler) Creates a new validation controller for a single form field. -
Method Summary
Modifier and TypeMethodDescriptionint
getId()
Returns the id of this validation controller.Returns the set of fields which have been validated.protected void
Starts the validation.protected void
onReceiveValidationResults
(Map<String, org.opencms.gwt.shared.CmsValidationResult> results) Internal method which is executed when the results of the asynchronous validation are received from the server.void
provideValidationResult
(String field, org.opencms.gwt.shared.CmsValidationResult result) Reports the result of a synchronous validation.void
setFormValidator
(String formValidatorClass) Sets the form validator class name for this validation controller.void
setFormValidatorConfig
(String formValidatorConfig) Sets the form validator configuration string.void
Starts the validation.void
validateAsync
(String field, String value, String validator, String config) Requests an server-side validation to be performed later.
-
Field Details
-
m_fields
The list of form fields which should be validated. -
m_validationQueries
A map containing all validation queries which should be executed asynchronously.
-
-
Constructor Details
-
CmsValidationController
Creates a new validation controller for a list of form fields.- Parameters:
fields
- the fields which should be validatedhandler
- the validation handler
-
CmsValidationController
Creates a new validation controller for a single form field.- Parameters:
field
- the form fieldhandler
- the validation handler
-
-
Method Details
-
getId
Returns the id of this validation controller.- Returns:
- an id
-
getValidatedFields
Returns the set of fields which have been validated.- Returns:
- the set of validated fields
-
setFormValidator
Sets the form validator class name for this validation controller.- Parameters:
formValidatorClass
- the class name of the form validator
-
setFormValidatorConfig
Sets the form validator configuration string.a
- Parameters:
formValidatorConfig
- the form validator configuration string
-
startValidation
Starts the validation.This uses the
CmsValidationScheduler
, so the validation only starts after the currently running or scheduled validations have finished running. -
validateAsync
Description copied from interface:I_CmsValidationController
Requests an server-side validation to be performed later.- Specified by:
validateAsync
in interfaceI_CmsValidationController
- Parameters:
field
- the field namevalue
- the value of the fieldvalidator
- the server-side validator class nameconfig
- the configuration string for the server-side validator- See Also:
-
internalStartValidation
Starts the validation. -
onReceiveValidationResults
protected void onReceiveValidationResults(Map<String, org.opencms.gwt.shared.CmsValidationResult> results) Internal method which is executed when the results of the asynchronous validation are received from the server.- Parameters:
results
- the validation results
-