dw.web
Class FormElementValidationResult
Object
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.
valid  :  boolean
States if the validation succeeded or failed.
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
addData(key : Object, value : Object) : void
Adds optional data acquired during validation.
getData() : Map
Provides optional data acquired during validation.
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
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
public FormElementValidationResult(valid : boolean, message : String, data : Map)
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
addData(key : Object, value : Object) : void
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

setValid
setValid(valid : boolean) : void
Sets if the validation succeeded or failed.
Parameters:
valid - if the validation succeeded