RepeatableValidator

Validator of RepeatableControl.

Validates controls that let the user add many rows of data (e.g. a list of authors, tags, categories).

Features:

  • Checking that values in given fields are unique

  • Validating the minimum and maximum number of items

It does not validate the rows' fields - the engine walks down to them itself through childContexts, as to the children of a section.

Constructors

Link copied to clipboard
constructor(validationOptions: RepeatableValidation? = null)

Properties

Link copied to clipboard
protected lateinit var errorManager: ErrorManager
Link copied to clipboard
protected lateinit var formSchema: FormSchema
Link copied to clipboard
protected lateinit var formState: FormState
Link copied to clipboard

Functions

Link copied to clipboard
internal fun isControlRequired(control: Control<*>, controlContext: ControlContext): Boolean

Checks whether the control is required, based on its configuration and dependencies.

Link copied to clipboard
internal fun isControlVisible(control: Control<*>, controlContext: ControlContext): Boolean
Link copied to clipboard
private fun isDependencyMet(dependency: ControlDependency<*>, controlContext: ControlContext): Boolean
Link copied to clipboard
internal fun isValueEmpty(value: Any?): Boolean

Checks whether the value is empty or not filled in.

Link copied to clipboard
internal open fun setupFormReferences(formState: FormState, formSchema: FormSchema, errorManager: ErrorManager)

Sets the form component references for the validator.

Link copied to clipboard
open fun validate(controlContext: ControlContext, state: ControlState<*>, control: Control<*>)

Main validation method of a control.

Link copied to clipboard
Link copied to clipboard
open override fun validateSpecific(controlContext: ControlContext, value: List<RepeatableRow>)

Validates that values are unique across the rows of a repeatable control. Works on the global form state.

Link copied to clipboard
private fun validateUniqueness(rows: List<RepeatableRow>, options: RepeatableValidation, controlContext: ControlContext): String?