← Back to team overview

dhis2-devs team mailing list archive

Re: [Bug 430657] Re: Date text field needs validation rule in data entry screen

 

2009/12/23 Lars Helge Øverland <larshelge@xxxxxxxxx>

>
> In this case I must agree with Viet. Validation becomes unusable without
> user feedback. Firstly user feedback is a presentation thing - it should not
> be mixed with the business logic concern. Secondly it is technically
> problematic to return user feedback from the business (model) layer - using
> exceptions is bad practice and return values should be reserved for the
> purpose of the method.
>
> Struts2 offers similar functionality to Spring WebMVC, where validation
> happens in a method on the controller and is invoked right after the action
> is invoked. Struts2 also offer AJAX-validation of fields on-the-fly. But
> that is a major rewrite...
>
> Lars
>
>
Well, having dedicated methods for validation in the service layer could
work... like validateDataElement( DataElement ) with constant string return
types which could be mapped to user-friendly messages in the presentation
layer. I see Bob's point of reusing those methods for other input sources.

References