- Home [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
- Getting started
- Use cases
-
API
- Object types
-
Data types
- AccountType
- DynamicFieldType
- EmailType
- OrganisationStructureItemType
- PhoneType
- ReplacementType
- ServiceStatus
- UserStatus
- WatermarkPages
- WatermarkPosition
- AccountFieldTyped
- AccountFieldVoid
- ApplicationField
- Cell
- ClientEventField
- CookieOptions
- DatetimeFieldData
- DynamicBindingField
- DynamicBindingFields
- EnumField
- ErrorArgs
- ErrorObject
- FileField
- FloatFieldData
- GroupStatusField
- HttpResponse
- ImageField
- Language
- MailMessageAddress
- MailMessageAttachment
- MoneyFieldData
- Navigator
- Page
- ParseSpreadsheetOptions
- ParseSpreadsheetResponse
- RefItem
- ReportField
- ReportRef
- Role
- RoleField
- Row
- ServiceStatusInfo
- StaticApplicationFieldData
- StatusField
- TAccount
- TClientEvent
- TDate
- TDatetime
- TDuration
- TEmail
- TEnum
- TFullName
- TMoney
- TPhone
- TReport
- TStatus
- TTable
- TTime
- TTimezone
- TTimezones
- TableField
- UserField
- UserFieldData
- ValidationResult
- Watermark
- WidgetRefWithValues
- ReplacementTypeEnumBase
- RoleType
- TApplication
- TBoolean
- TCategory
- TFile
- TFloat
- TImage
- TJSON
- TLink
- TOAuth2
- TRole
- TString
- TUser
- Global constants
- Work with apps
- Web requests
- Access permissions
- Document flow
- Live Chats
- “Code” widget
- Signatures
- Business calendars
- Integration with IP telephony
- Integration with email marketing services
Validation result
This type allows you to form the result of custom form validation. It has a constructor. If you call it without specifying parameters, it returns an empty validation result object:
const result = new ValidationResult();
You can pass the array of error messages (
messages
) and lists of errors in context fields (contextErrors
andviewContextErrors
) to the constructor.const result = new ValidationResult( [`All checkboxes on the form need to be checked`], { stringname: ['The value needs to be at least 10 characters long'], stringname_2: ['The value cannot be longer than 50 characters'], }, { number_1: ['The value needs to be less than or equal to 50'], }, );
There can be several validation error messages for each context or View context field. If an error message with the same text is added for a context field with the same code, the duplicate is ignored. Example usage in a validation function:
const result = new ValidationResult(); if ( !Context.data.stringname || Context.data.stringname.length < 10) { result.addContextError('stringname', 'The value needs to be at least 10 characters long'); } if (!ViewContext.data.number_1 || ViewContext.data.number_1 > 50) { result.addViewContextError( 'number_1', 'The value needs to be shorter than or equal to 50 characters'); } return result;
Hierarchy
Properties
contextErrors
Object that stores a list of unsuccessful validation results for context fields.
The key is the code of the context field, and the value is the array of the error description strings.
Type declaration
[key: string]: string[]
Readonly hasContextErrors
The property’s value is
true
if the validation of context fields was not successful.Readonly hasViewContextErrors
The property’s value is
true
if the validation of View context fields was not successful.Readonly isValid
The property’s value is
true
if validation was not successful.messages
Array of unsuccessful validation.
Optional title
Header of the validation error message. You can set it if you want to overwrite the standard one.
For example:
result.title = 'You have to fill out all the fields on the form to register the document';
viewContextErrors
Object that stores a list of unsuccessful validation results for View context fields.
The key is the code of a View context field, and the value is an array of error description strings.
Type declaration
[key: string]: string[]
Methods
addContextError
Add error of context field validation.
For example:
result.addContextError('stringname', 'The value needs to be at least 10 characters long');
Parameters
code: string
message: string
Returns void
addMessage
Add validation error message without being tied to context fields.
Example:
result.addMessage('All checkboxes on the form need to be checked');
Parameters
errorMessage: string
Returns void
addViewContextError
Add a View context field validation error.
For example:
result.addViewContextError('stringname', 'The value needs to be at least 10 characters long');
Parameters
code: string
message: string
Returns void
assign
Merge the current unsuccessful validation result with another unsuccessful validation result.
Parameters
Optional callResult: ValidationResult
Returns void
Properties
Methods