Anyone have an example of where they styled a form...
# tornadofx
d
Anyone have an example of where they styled a form field decorator? I have something like this
Copy code
fieldset {
    field("Name") {
        addClass(styles.new_category_view__form_label)
        vbox {
            textfield(viewModel.name) {
                addClass(styles.new_category_view__form_input)
                required(message = "Please enter a category name.")
                action {
                    save()
                }
            }

            // Error label gets set on decoration.
            label("") {
                style { padding = box(5.px, 10.px) }
            }
        }
    }
}
Where my decorator sets the label by finding it.
Copy code
class MyDecorator(private val validationMessage: ValidationMessage) : Decorator {
    override fun decorate(node: Node) {
        node.addClass(styles.new_category_view__error)
        node.parent.getChildList()!!
            .filter { it is Label }
            .forEach { (it as Label).text = validationMessage.message }
    }

    override fun undecorate(node: Node) {
        node.removeClass(styles.new_category_view__error)
        node.parent.getChildList()!!
            .filter { it is Label }
            .forEach { (it as Label).text = "" }
    }
}
Just wondering if anyone has an example of this, or a better suggested way. I end up with something like this, which is close, but the label for the input is not aligned with the textfield anymore.