diff options
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/form/Form.kt | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/Form.kt b/src/main/kotlin/pl/treksoft/kvision/form/Form.kt index 3eb94f64..783653ce 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/Form.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/Form.kt @@ -311,7 +311,7 @@ class Form<K : Any>( if (markFields) control.validatorError = trans(fieldsParams?.requiredMessage) ?: "Value is required" true } else { - val validatorPassed = control.visible && (fieldsParams?.validator?.invoke(control) ?: true) + val validatorPassed = !control.visible || (fieldsParams?.validator?.invoke(control) ?: true) if (markFields) { control.validatorError = if (!validatorPassed) { trans(fieldsParams?.validatorMessage?.invoke(control)) ?: "Invalid value" |