tornadofx icon indicating copy to clipboard operation
tornadofx copied to clipboard

set input control's decorated message without validation

Open sergeych opened this issue 5 years ago • 1 comments

often we need to show an error bound to an input after calling some async API. It does not fit validation model as the error outcome is a result of attempting an operation on whole inputs set. So we can implement it as a plain validator without dirty and ugly hacks. Should be nice to be able to add one-time ValidationMessage to the input, like:

textField.addValidationMessage(ValidationMessage(apiErrorText, ValidationSeverity.Error)

So it will be shown as a regular validation error until next data change in the control. It works this way, say, in android. Actually, using decorators to pass user hints has much wider applicable domain than just validation results. Notifications, hints, notes - all that does not fit validator model at all.

sergeych avatar Nov 19 '20 17:11 sergeych

I think it would be better to have fallible asynchronous commit for the whole view model (i.e. before commit is completed, run a function which can fail the entire commit and may wait for the results of some async operation), since then rollback and dirty states will work better. A number of client-server models require such asynchronicity, so handling this in the view model would be much nicer.

comp500 avatar Apr 13 '22 22:04 comp500