Got a question about a textfield validator: I have...
# tornadofx
j
Got a question about a textfield validator: I have a simple view with an FXML and am trying to add a validator to the textfield:
Copy code
private val fooModel: FooModel by inject()
private val foo: TextField by fxid()
init {
  foo.textProperty().bindBidirectional(fooModel.barProperty)
  foo.validator {
    success("OK")
  }
}
Running the app with the validator statement throws an IllegalArgumentException "The addValidator extension can only be used on inputs that are already bound bidirectionally to a property in a Viewmodel. Use validator.addValidator() instead or make the property's bean field point to a ViewModel." I thought the previous statement did the bidirectional bind. Any tips?