Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Invalid
-
8.0.0-M4
-
None
-
None
Description
I was tinkering around with Kotlin and Wicket and had the following snippet:
val housenumbervalue: Int? = null
val housenumberModel: IModel<Int> = Model<Int>()
val housenumber = TextField<Int>("housenumberModel", housenumberModel, Int::class.java)
val form: Form<Unit> = object : Form<Unit>("adressForm") {}
override fun onInitialize() {
super.onInitialize()
form.add(housenumber.setRequired(false))
form.add(object : SubmitLink("submit") {
override fun onSubmit()
})
add(form)
}
This code resulted in
org.apache.wicket.WicketRuntimeException: FormComponent can't be required when the type is primitive class: [TextField [Component id = housenumberModel]]
at org.apache.wicket.markup.html.form.FormComponent.setRequired(FormComponent.java:1052)
at com.mycompany.test.web.pages.Test.onInitialize(Test.kt:28)
Turns out that setRequired was checking only if the FormComponent was not required. It should be the other way round. I opened a pull request.
Attachments
Issue Links
- links to