dw.web
Class FormElementValidationResult
dw.web.FormElementValidationResult
Represents a form element validation result. The validation script specified for form groups and fields can create
such FormElementValidationResult with the desired validity, message and data and can then return it. The server side form
element validation will evaluate these settings, i.e. calculate the corresponding element validity and message. The optional
data provided with this instance will be kept and can be accessed again from the form element after server side validation.
Properties
data
:
Map
(Read Only)
Provides optional data acquired during validation.
message
:
String
Provides an optional message in case of validation failure.
Constructor Summary
FormElementValidationResult(valid
:
boolean)
Creates a FormElementValidationResult with given setting for the validity but without any message.
FormElementValidationResult(valid
:
boolean, message
:
String)
Creates a FormElementValidationResult with given setting for the validity and corresponding message.
FormElementValidationResult(valid
:
boolean, message
:
String, data
:
Map)
Creates a FormElementValidationResult with given setting for the validity and corresponding message.
Method Summary
getMessage()
:
String
Provides an optional message in case of validation failure.
isValid()
:
boolean
States if the validation succeeded or failed.
setMessage(message
:
String)
:
void
Sets an optional message in case of validation failure.
setValid(valid
:
boolean)
:
void
Sets if the validation succeeded or failed.
Methods inherited from class
Object
assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values
Constructor Detail
FormElementValidationResult
public FormElementValidationResult(valid
:
boolean)
Creates a FormElementValidationResult with given setting for the validity but without any message.
Parameters:
valid
-
the desired validity
FormElementValidationResult
public FormElementValidationResult(valid
:
boolean, message
:
String)
Creates a FormElementValidationResult with given setting for the validity and corresponding message.
This is especially useful to represent a failed validation including some error message.
Parameters:
valid
-
the desired validity
message
-
the desired message
FormElementValidationResult
Creates a FormElementValidationResult with given setting for the validity and corresponding message.
This is especially useful to represent a failed validation including some error message. Additional
data can be stored, too.
Parameters:
valid
-
the desired validity
message
-
the desired message
data
-
the desired data
Method Detail
addData
Adds optional data acquired during validation.
Parameters:
key
-
the key for which the data value will be stored
value
-
the data value that is stored for the given key
getData
getData()
:
Map
Provides optional data acquired during validation.
Returns:
the data acquired during validation
getMessage
getMessage()
:
String
Provides an optional message in case of validation failure.
Returns:
the message for validation failure
isValid
isValid()
:
boolean
States if the validation succeeded or failed.
Returns:
true if the validation succeeded
setMessage
setMessage(message
:
String)
:
void
Sets an optional message in case of validation failure.
Parameters:
message
-
the message for validation failure