sialcasa / mvvmFX

an Application Framework for implementing the MVVM Pattern with JavaFX
Apache License 2.0
496 stars 104 forks source link

On demand validation #618

Open daniel-sarov opened 3 years ago

daniel-sarov commented 3 years ago

Are there any plans to include on demand validation, using ControlsFxVisualizer , like in controlsfx : validationSupport.setErrorDecorationEnabled(true or false)?

manuel-mauky commented 3 years ago

What does this flag do in controlsfx? In the JavaDoc I haven't found a good description. What is the desired behavior?

daniel-sarov commented 3 years ago

With this flag there is a way to suppress error decorations, when the "validators" are registered in "validationSupport" in controlsfx with: validationSupport.setErrorDecorationEnabled(false). Later, when we actually want to validate (on submit button for example) we need to reset it to default value: validationSupport.setErrorDecorationEnabled(true). This way, fields still get validated by every change but error decorations are not shown until we actually want them to be shown.

https://github.com/controlsfx/controlsfx/issues/226 https://stackoverflow.com/questions/41603284/validate-javafx-form-only-after-submission-using-validationsupport

It would be nice after "ControlsFxVisualizer" initialization in View like this: ValidationVisualizer visualizer = new ControlsFxVisualizer(); visualizer.initVisualization(...); to use similar methods to the following where it is necessary : visualizer.hideErrorDecoration() , visualizer.showErrorDecoration() or like in controlsfx - setErrorDecorationEnabled(...)

manuel-mauky commented 3 years ago

This sounds good. We would need to:

Adjustments to the actual visualizer implementations like ControlsFXVisualization shouldn't be needed as far as I can see.

However, I'm not sure if I will find the time to implement this in the near future. If you like, I'm happy to accept a PR for this feature.

daniel-sarov commented 3 years ago

Ok, when i have spare time , i will do it and send PR.