SubmissionControl

class SubmissionControl<T>(val policy: SubmissionPolicy, val rule: FormRule<T>, val submit: () -> Unit, val initialValue: T, val getValue: () -> T, val hasError: () -> Boolean, val getFieldKeys: () -> FormFieldNames, val isSubmitting: () -> Boolean, val isSubmitted: () -> Boolean, val getSubmitCount: () -> Int)

Represents a submission control in a form.

Parameters

T

The type of the form value.

Constructors

Link copied to clipboard
constructor(policy: SubmissionPolicy, rule: FormRule<T>, submit: () -> Unit, initialValue: T, getValue: () -> T, hasError: () -> Boolean, getFieldKeys: () -> FormFieldNames, isSubmitting: () -> Boolean, isSubmitted: () -> Boolean, getSubmitCount: () -> Int)

Creates a submission control.

Properties

Link copied to clipboard

The function to get the keys of the form fields.

Link copied to clipboard
val getSubmitCount: () -> Int

The function to get the number of times submission process was called.

Link copied to clipboard
val getValue: () -> T

The function to get the current form value.

Link copied to clipboard
val hasError: () -> Boolean

The function to determine if the form has errors.

Link copied to clipboard

The initial value of the form.

Link copied to clipboard
val isSubmitted: () -> Boolean

The function to determine if the form has been submitted.

Link copied to clipboard

The function to determine if the form is currently submitting.

Link copied to clipboard

The policy of the submission.

Link copied to clipboard

The rule to validate the form value.

Link copied to clipboard
val submit: () -> Unit

The function to submit the form.

Functions

Link copied to clipboard
fun validate(value: T, dryRun: Boolean = false): Boolean

Validates the form value.