rjaros / kvision

Object oriented web framework for Kotlin/JS
https://kvision.io
MIT License
1.2k stars 66 forks source link

Initial value for DateTime control #504

Closed chavu closed 6 months ago

chavu commented 6 months ago

Setting the initial value of the DateTime control is not working. Try tried the following but both are not working... the current date is not displayed on the control.

     hPanel {
            spacing = 10
            width = 50.perc
            span("Date raised")
            dateTime(
                format = "DD-MM-YYYY",
               value = Date(now())
            ).bind(TestIssue::dateRaised,
                    required = true,
                    requiredMessage = "This field is required",
            )
        }
     hPanel {
            spacing = 10
            width = 50.perc
            span("Date raised")
            dateTime(
                format = "DD-MM-YYYY",
            ) {
                value = Date(now())
            }.bind(TestIssue::dateRaised,
                    required = true,
                    requiredMessage = "This field is required",
            )
        }
chavu commented 6 months ago

Sorry, never mind. I realised I was setting the form values using an object just before displaying the form thereby overwriting value set in the form definition.