Valid

value class Valid : Input

A valid input.

Properties

Link copied to clipboard

Whether this is Input.Empty

Link copied to clipboard

Whether the actual string of this Input is blank

Link copied to clipboard

Whether this is Input.Invalid

Link copied to clipboard

Whether this is Input.Valid

Link copied to clipboard

Whether this Input is valid or empty

Link copied to clipboard
open override val value: String

A current string value that the input holds

Functions

Link copied to clipboard
open fun copy(value: String = this.value): Input

Copy the input. Type and errors are preserved

Link copied to clipboard
infix fun Input.mustMatch(other: Input): Input

Applies an additional Rules.Equals to this input, then appends the result of the validation to other validation errors present, if any. Allows to create an Input that must always match some other one Don't forget to run the validation on both the dependent and the original inputs when any of them changes.

Link copied to clipboard

Returns Input.value if it is valid, otherwise an empty string

Link copied to clipboard

Returns Input.value if it is valid, otherwise null

Link copied to clipboard
fun Input.validate(form: Form): Input

Validate this Input using a given form.

fun Input.validate(rule: Rule): Input

Validate this Input using the given rule. Previous errors are preserved.

Link copied to clipboard

Returns null if this Input is not valid, otherwise returns Input.value