aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2019-12-02 10:03:42 +0100
committerRobert Jaros <rjaros@finn.pl>2019-12-02 10:03:42 +0100
commit1cb9cc8ff1378171280f07f8143145d78e61dab4 (patch)
treeeb15948309af473f0a9ba6ed55de9f461b6abc0b
parentff01aaf8ca434488a8566dc48314e933347628ef (diff)
downloadkvision-1cb9cc8ff1378171280f07f8143145d78e61dab4.tar.gz
kvision-1cb9cc8ff1378171280f07f8143145d78e61dab4.tar.bz2
kvision-1cb9cc8ff1378171280f07f8143145d78e61dab4.zip
Auto marking of required form fields
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/FormPanel.kt1
-rw-r--r--src/main/resources/css/style.css5
2 files changed, 6 insertions, 0 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/FormPanel.kt b/src/main/kotlin/pl/treksoft/kvision/form/FormPanel.kt
index 0decc5e9..aadd57cf 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/FormPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/FormPanel.kt
@@ -239,6 +239,7 @@ open class FormPanel<K : Any>(
FormType.HORIZONTAL -> control.styleForHorizontalFormPanel(horizRatio)
else -> control.styleForVerticalFormPanel()
}
+ if (required) control.flabel.addCssClass("required-label")
super.add(control)
form.addInternal(key, control, required, requiredMessage, validatorMessage, validator)
return this
diff --git a/src/main/resources/css/style.css b/src/main/resources/css/style.css
index dbc65278..4adc61c0 100644
--- a/src/main/resources/css/style.css
+++ b/src/main/resources/css/style.css
@@ -104,6 +104,11 @@ trix-toolbar .trix-button-group {
min-width: 200px;
}
+label.required-label::after {
+ content: " *";
+ color: #dc3545;
+}
+
.kv-spinner-btn-none .input-group-btn-vertical {
display: none;
}