rememberFieldRuleControl

fun <T : Any, V> FormScope<T>.rememberFieldRuleControl(name: FieldName, select: T.() -> V, update: T.(V) -> T, enabled: T.() -> Boolean = { true }, dependsOn: Set<FieldName>? = null, builder: ValidationRuleBuilder<V>.() -> Unit): FieldControl<V>

Deprecated

Please migrate to the new form implementation. This legacy code will be removed in a future version.

Remembers a field control for the given field name with the given rule set.

Usage:

rememberFieldRuleControl(
name = "First name",
select = { firstName },
update = { copy(firstName = it) }
) {
notBlank { "must be not blank" }
}

Parameters

T

The type of the form value.

V

The type of the field value.

name

The name of the field.

select

The function to select the field value.

update

The function to update the field value.

enabled

The function to determine if the field is enabled.

dependsOn

The set of field names that this field depends on.

builder

The block to build the rule set.


fun <T : Any, V> FormScope<T>.rememberFieldRuleControl(name: FieldName, select: T.() -> V, update: T.(V) -> T, enabled: T.() -> Boolean = { true }, dependsOn: Set<FieldName>? = null, ruleSet: ValidationRuleSet<V>): FieldControl<V>

Deprecated

Please migrate to the new form implementation. This legacy code will be removed in a future version.

Remembers a field control for the given field name with the given rule set.

Usage:

val ruleSet = rules<String> {
notBlank { "must be not blank" }
}

rememberFieldRuleControl(
name = "First name",
select = { firstName },
update = { copy(firstName = it) },
ruleSet = ruleSet
)

Parameters

T

The type of the form value.

V

The type of the field value.

name

The name of the field.

select

The function to select the field value.

update

The function to update the field value.

enabled

The function to determine if the field is enabled.

dependsOn

The set of field names that this field depends on.

ruleSet

The rule set to validate the field value.