Hi,
There are times when one wants to inform the user of some sort of problem with the business logic, but an error (preventing a save of the object) may be too strict. It would be beneficial to show the user a warning so that the user can have his/her attention drawn to it, but not be prevented from saving the object.
Proposed Solution:
Dionisis Soldatos wrote in S135644:
"RuleRequiredField("Customer.Phone", DefaultContexts.Save, "The Customer Phone is Empty",TypeOfMessage.Warning)
or
RuleRequiredField("Customer.code", DefaultContexts.Save, "The Customer Code is Empty",TypeOfMessage.Error)
add new property to rulectriteria TypeOfMessage"
Validation - Warn end-users about mistakes/inconsistencies without preventing them from saving changes
Answers approved by DevExpress Support
We have implemented the functionality described in this ticket. It will be included in our next update(s).
Please check back and leave a comment to this response to let us know whether or not this solution addresses your concerns.
You can now define validation rules that can be ignored by end-users by setting the rule's ResultType property to Warning or Info.
See Also: XAF: Soft Validation (What’s New in 13.2)
- v13.2.5Download Official Update
There is a lesser known framework called SAP. May be a few of you have heard about it? They have had warnings for over 15 years may be more. But that's what smaller unknown framework do… they implement all these useless features which are not priority for the majority in the hope of attracting clients.
Joking apart, this is thanksgiving here in the US so a big thank you Devexpress for implementing this. I promise not to ask about reminder in the Scheduler Module before another few months. ;)
Happy thanksgiving all.
Currently, to work around this, you can use the approach shown in the OBSOLETE - How to provide custom rules validation via the RuleSet's events example. For instance, you can skip the default validation and then show a message to a user using the DevExpress.ExpressApp.Web.ErrorHandling.SetPageError method in Web Forms. In Windows Forms you can show a warning message to a user using the standard MessageBox class, or something else.
Alternatively, you can manually validate your objects when editors lost focus, as described in the Implement Custom Contexts help topic.
See Also:
Validation - Add validation support for business classes implementing the IDXDataErrorInfo interface
http://community.devexpress.com/forums/227981/PostAttachment.aspx - here is the solution that uses the IDXDataErrorInfo interface
UPDATE:
The latest and more complete solution is available at UI Annotation using Business Rules
Thanks,
Dennis
For people following this issue, Dennis has been hard at work: http://dennisgaravsky.blogspot.com/2013/07/developing-validation-warnings-feature.html
There is a similar discussion:
- "XAF Validation Module" at http://community.devexpress.com//forums/p/68748/233906.aspx#233906
Thanks, Dan