|
ColdBox Platform v3.8.0 | ||||
FRAMES |
WEB-INF.cftags.componentcoldbox.system.validation.result.ValidationResult
public class ValidationResult
Property Summary | ||||
---|---|---|---|---|
Type | Property & Description | Default | Serializable | Required |
struct
|
constraints
The constraints evaluated in the validation process Attributes: |
|
true
|
false
|
array
|
errors
A collection of error objects represented in this result object Attributes: |
|
true
|
false
|
string
|
locale
The locale this result validation is using Attributes: |
|
true
|
false
|
any
|
resourceBundle
The resource bundle object Attributes: |
|
true
|
false
|
struct
|
resultMetadata
Extra metadata you can store in the results object Attributes: |
|
true
|
false
|
string
|
targetName
The name of the target object Attributes: |
|
true
|
false
|
Constructor Summary | |
---|---|
init([string locale=''], [string targetName=''], [any resourceBundle=''], [struct constraints='[runtime expression]'])
|
Method Summary | |
---|---|
struct |
GETCONSTRAINTS()
get: The constraints evaluated in the validation process |
array |
GETERRORS()
get: A collection of error objects represented in this result object |
string |
GETLOCALE()
get: The locale this result validation is using |
any |
GETRESOURCEBUNDLE()
get: The resource bundle object |
ValidationResult |
SETCONSTRAINTS(struct constraints)
set: The constraints evaluated in the validation process |
ValidationResult |
SETERRORS(array errors)
set: A collection of error objects represented in this result object |
ValidationResult |
SETRESOURCEBUNDLE(any resourceBundle)
set: The resource bundle object |
IValidationResult |
addError(IValidationError error)
Add errors into the result object |
IValidationResult |
clearErrors()
Clear All errors |
array |
getAllErrors([string field])
Get the Errors Array, which is an array of error messages (strings) |
string |
getAllErrorsAsJSON([string field])
Get all errors or by field as a JSON structure |
struct |
getAllErrorsAsStruct([string field])
Get all errors as flat structure that can easily be used for UI display |
numeric |
getErrorCount([string field])
Get how many errors you have |
coldbox.system.validation.result.IValidationError[] |
getFieldErrors(string field)
Get an error object for a specific field that failed |
struct |
getResultMetadata()
Get a collection of metadata about the validation results |
string |
getTargetName()
Get the name of the target object that got validated |
string |
getValidationLocale()
Get the validation locale |
private void |
globalReplacements(any message, any error)
|
boolean |
hasErrors([string field])
Determine if the results had error or not |
boolean |
hasLocale()
has locale information |
IValidationError |
newError([struct properties])
Get a new error object |
IValidationResult |
setLocale(string locale)
Set the validation locale |
IValidationResult |
setResultMetadata(struct data)
Set a collection of metadata into the results object |
IValidationResult |
setTargetName(string name)
Set the validation target object name |
Methods inherited from class WEB-INF.cftags.component |
---|
None
|
Constructor Detail |
---|
public init([string locale=''], [string targetName=''], [any resourceBundle=''], [struct constraints='[runtime expression]'])
locale
targetName
resourceBundle
constraints
Property Detail |
---|
struct constraints
default
- serializable
- truerequired
- falsearray errors
default
- serializable
- truerequired
- falsestring locale
default
- serializable
- truerequired
- falseany resourceBundle
default
- serializable
- truerequired
- falsestruct resultMetadata
default
- serializable
- truerequired
- falsestring targetName
default
- serializable
- truerequired
- falseMethod Detail |
---|
public struct GETCONSTRAINTS()
public array GETERRORS()
public string GETLOCALE()
public any GETRESOURCEBUNDLE()
public ValidationResult SETCONSTRAINTS(struct constraints)
constraints
public ValidationResult SETERRORS(array errors)
errors
public ValidationResult SETRESOURCEBUNDLE(any resourceBundle)
resourceBundle
public IValidationResult addError(IValidationError error)
addError
in interface
IValidationResult
error
- The validation error to add into the results objectpublic IValidationResult clearErrors()
clearErrors
in interface
IValidationResult
public array getAllErrors([string field])
getAllErrors
in interface
IValidationResult
field
- The field to use to filter the error messages on (optional)public string getAllErrorsAsJSON([string field])
field
public struct getAllErrorsAsStruct([string field])
field
public numeric getErrorCount([string field])
getErrorCount
in interface
IValidationResult
field
- The field to count on (optional)public coldbox.system.validation.result.IValidationError[] getFieldErrors(string field)
getFieldErrors
in interface
IValidationResult
field
- The field to return error objects onpublic struct getResultMetadata()
getResultMetadata
in interface
IValidationResult
public string getTargetName()
getTargetName
in interface
IValidationResult
public string getValidationLocale()
getValidationLocale
in interface
IValidationResult
private void globalReplacements(any message, any error)
message
error
public boolean hasErrors([string field])
hasErrors
in interface
IValidationResult
field
- The field to count on (optional)public boolean hasLocale()
hasLocale
in interface
IValidationResult
public IValidationError newError([struct properties])
properties
public IValidationResult setLocale(string locale)
setLocale
in interface
IValidationResult
locale
public IValidationResult setResultMetadata(struct data)
setResultMetadata
in interface
IValidationResult
data
public IValidationResult setTargetName(string name)
setTargetName
in interface
IValidationResult
name
|
ColdBox Platform v3.8.0 | ||||
FRAMES |