diff options
author | Robert Jaros <rjaros@finn.pl> | 2020-03-16 19:01:43 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2020-03-16 19:01:43 +0100 |
commit | e2b18ce34be2ac5d281e7e2b191bacef8f55acff (patch) | |
tree | d4249f6eca0362d540c551135e862c57fc288864 /src/main/kotlin/pl | |
parent | 460c41d4a823589d1f60c7bd31d0a350a1a783f2 (diff) | |
download | kvision-e2b18ce34be2ac5d281e7e2b191bacef8f55acff.tar.gz kvision-e2b18ce34be2ac5d281e7e2b191bacef8f55acff.tar.bz2 kvision-e2b18ce34be2ac5d281e7e2b191bacef8f55acff.zip |
Fix forms validation for hidden fields.
Diffstat (limited to 'src/main/kotlin/pl')
-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" |