Current filter:
                                You should refresh the page.
                                  • 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)
                                    RuleRequiredField("Customer.code", DefaultContexts.Save, "The Customer Code is Empty",TypeOfMessage.Error)
                                    add new property to rulectriteria TypeOfMessage"

                                2 Solutions

                                Creation Date Importance Sort by


                                Additional information:

                                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)

                                Show all comments
                                • Krzysztof Krzyzsłof 11.27.2013

                                  Sounds great!

                                • drew.. 11.27.2013

                                  fabulous news!

                                • Chris Royle (LOB) 11.27.2013

                                  Excellent. Christmas has come early this year ;)

                                • Robert Fuchs 11.27.2013

                                  @Chris: This isn't for Christmas - it's for Thanksgiving ;-)
                                  Give big thanks to DX for having it finally implemented after 6 years of struggling, I guess not only Drew will remember this:
                                  "Validation is not an analog scale; a business object is either valid for a particular context (save for example) or it is not, much as a lady is either pregnant or she is not." (Gary Short - 2008) - ROTFL
                                  Ok guys, no hard feelings!
                                  13.2 Beta is running great so far - much enjoy it.

                                • Luc DEBRUN 11.27.2013

                                  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.

                                • Dennis (DevExpress) 11.27.2013

                                  You are always welcome, Guys:-)

                                • Daniele M 11.27.2013

                                  Great!!!! Thanks Dennis

                                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
                       - here is the solution that uses the IDXDataErrorInfo interface
                                The latest and more complete solution is available at UI Annotation using Business Rules

                                Show all comments
                                • Anatol (DevExpress Support) 10.25.2011

                                  If you are using eXpand, you may be interested to know that this kind of validation rule is now supported in it - see Validation Rule Warning support. If you are not currently using it, maybe this is a good reason to try it.

                                • Chris Royle (LOB) 02.08.2013

                                  So this is still not done and we're directed to use eXpand - such a cop-out DX.

                                • drew.. 02.08.2013

                                  @Chris: over 5 years ago, we had an animated and almost aggressive pushback from Oliver (when he worked for DX) on this matter. It seems that such real-life scenarios mean little within the almost academic meeting halls where the directives get set. This is too bad.

                                • Chris Royle (LOB) 02.08.2013

                                  Yes Drew, I read through the (now read-only) forum posts with an increasing sense of frustration.

                                • Carlitos 02.08.2013

                                  I use the state machine module and validation module together for what you're saying. For example, I have an Order and OrderDetails. The Order has a Status Property. So once the order is saved the status is set to the initial state whatever that is. Then as employees check that the Order can be fulfill/met according to customers specifications, it moves on to the next status until the order is fulfilled or cancelled (both are final statuses of an Order). My logic states that if some property is not valid at a specific status, it will not allow the transition to the next state. Tolis also created a nice tutorial on how to do some simple security on transitions. I.e. only Managers can validate/approve the order for production. Have a look at that. Maybe it will help you.

                                • drew.. 02.08.2013

                                  @Carlitos: the use-case you describe, while similar in that data is being edited and saved, is not the use-case we have pushed for. This is a very simple scenario: we simply want to flag validations for saving to be warnings but allow the user to continue with the save, nothing more, To many of us, it seems a simple request within the bowels of xaf.

                                • Carlitos 02.08.2013

                                  The state machine has the Appearance module that you can use to highlight (Background = Red) when your validation detects something is wrong. It will allow you to save, but it will highlight the property that didn't pass your validation logic.

                                • Apostolis Bekiaris (DevExpress) 02.08.2013


                                  First thanks for your healthy feedback however note that we always monitor this thread to see how many are interested. Currently there are more important priorities and eXoand has a descent and stable implementation. By using the open source implementation you are not getting less support as well. Trying to official implement all possible business extensions is not realist. XAF offers a validation engine so flexible that you can do amazing stuff. After the Validation module evaluates a rule you can for example change the UI as you wish to define what warning is as eXpand did or execute an action (see Context programming) or go for a Statemachine, WorkFlow, Validation collaboration or for other more domain specific scenarios. We already show off how easy this is done and open source the solution to make it stable since many are using it.

                                • drew.. 02.08.2013

                                  State Validation and Workflow are overkill in most scenarios. XAF does not allow for this simple, and absolutely basic framework requirement. If xaf's validation engine is so flexible, why are we still asking for this feature? Perhaps it is now implemented and we all just missed the news? So much energy spent asking and getting denied, it could have been done by now, a few hundred times over ;)

                                • Chris Royle (LOB) 02.08.2013

                                  Apostolis, with the greatest respect in the world not everyone wants to use eXpand.

                                  This appears to be a very simple item to implement, and looking at the forum it is something that a number of users past and present have a need for.

                                  I'm fully aware of how fantastic the validation system is, but it doesn't cover warning conditions, and this is not a workflow issue.

                                  If the company line is that DX are too busy to develop functionality requested 5 YEARS ago and argued for by many people then clearly I've attached my cart to the wrong horse.

                                • Carlitos 02.08.2013

                                  Can you show what you're doing in code? StateMachine is not so overkill as workflow but I agree it does require some configuration. Still doable though. Maybe your requests can be done just with the appearance module?

                                • Chris Royle (LOB) 02.08.2013

                                  Here's some simple examples Carlitos - they may be a little contrived:

                                  - Doctors surgery capturing patient records - capturing date of birth:
                                  It'd be nice to have a warning when someone enters a DOB > 100 years. It's not impossible that a patient is > 100, but generally unlikely - and more likely to be a data entry error. The same date "validation" can be applied in many places e.g Delivery dates in the future, planned production dates in the future etc - or perhaps setting dates before DateTime.Now() - say for example when someone is catching up on data entry.

                                  - Purchase Orders:
                                  It's possible to receive more items from a supplier than ordered. The can be because a supplier has a min order qty, or a pack size which cannot be split. This should be highlighted during posting (conditional appearance doesn't cut it), and the user can choose to amend the data at this point or continue ..... they may have for example chosen the wrong pack size.


                                  Simple things that improve the quality of data entry.

                                • Apostolis Bekiaris (DevExpress) 02.08.2013

                                  @Chris with the Validation module you can describe your case. This means that if you like you can use our open source Warning implementation.

                                  1. RuleTypeController, WinRuleTypeController, WebRuleTypeController
                                  2. RuleErrorTypeAttribute.cs
                                  3. RuleTypeGeneratorUpdater.cs

                                  click the Browse code link under the hash to see the current code base for each file.

                                • Chris Royle (LOB) 02.08.2013

                                  Thanks Apostolis.

                                • Eric Upton3 02.08.2013

                                  Hello Everyone,
                                  I too would like to see a native warning implementation from the XAF team . However, in the meantime, I've created something that works for me and could be useful to others.
                                  I initially started with an idea from someone else on the community forums and then extended it to meet our requirements. I don't know who or where to give credit now.
                                  I'll give an overview of the what it took for me to accomplish this. Also I've only implemented the winform platform. But it shouldn't be too difficult to get it going on the web as well . In my Base class I implemented the IDXDataErrorInfo Interface.
                                  This is how I implemented the GetPropertyError method in my base class, notice I'm using the following contexts: Critical, Warning, Information. Then in my rules, I use these contexts to determine the error icon that will be shown. Obviously, you can use your own contexts, but this works for me.

                                  public void GetPropertyError(string propertyName, ErrorInfo info) { RuleSetValidationResult result = Validator.RuleSet.ValidateTarget(this, "Critical"); if (result.State == ValidationState.Invalid) { foreach (var r in result.Results) { if (r.State == ValidationState.Invalid && r.Rule.UsedProperties.Contains(propertyName)) { info.ErrorText = r.ErrorMessage; info.ErrorType = ErrorType.Critical; return; } } } else { info.ErrorText = string.Empty; info.ErrorType = ErrorType.None; } result = Validator.RuleSet.ValidateTarget(this, "Warning"); if (result.State == ValidationState.Invalid) { foreach (var r in result.Results) { if (r.State == ValidationState.Invalid && r.Rule.UsedProperties.Contains(propertyName)) { info.ErrorText = r.ErrorMessage; info.ErrorType = ErrorType.Warning; return; } } } else { info.ErrorText = string.Empty; info.ErrorType = ErrorType.None; } result = Validator.RuleSet.ValidateTarget(this, "Information"); if (result.State == ValidationState.Invalid) { foreach (var r in result.Results) { if (r.State == ValidationState.Invalid && r.Rule.UsedProperties.Contains(propertyName)) { info.ErrorText = r.ErrorMessage; info.ErrorType = ErrorType.Information; return; } } } else { info.ErrorText = string.Empty; info.ErrorType = ErrorType.None; } }

                                  After implementing the IDXDataErrorInfo Interface, we can then use the DxErrorProvider to show the warnings. You need to created a DetailViewForm Template. You'll need to research creating your own templates since this code may not be a complete sample, but is intended to point you in the proper direction.

                                  public partial class DetailViewForm : DevExpress.ExpressApp.Win.Templates.XtraFormTemplateBase, ISupportClassicToRibbonTransform, IInfoPanelTemplateWin { protected override void OnLoad(EventArgs e) { base.OnLoad(e); base.View.CurrentObjectChanged += new EventHandler(View_CurrentObjectChanged); if (base.View.CurrentObject != null) { this.dxErrorProvider1.DataSource = base.View.CurrentObject; } } void View_CurrentObjectChanged(object sender, EventArgs e) { this.dxErrorProvider1.DataSource = base.View.CurrentObject; } }

                                  You will need to register your templates in the WinApplication.CreateCustomTemplate Event

                                  static void winApplication_CreateCustomTemplate(object sender, CreateCustomTemplateEventArgs e) { if (e.Context == TemplateContext.View) { e.Template = new Test.Module.Win.Templates.DetailViewForm(); } }

                                  It's been a while since I've implemented this, but I believe this is all that I needed to do. Hope it helps someone. By the way, I"m sure it can be refactored and improved, it's just an implementation that we are using for our needs. If you do improve it, share it with us.

                                • Carlitos 02.08.2013

                                  On the Dates stuff, I have mickey moused it like in the attached file. Not so professional, but it works. ;) (I'm not a developer, sorry if my code offends anybody). It will highlight before saving so that the user see something on screen while entering data.
                                  On the Purchase Order stuff, it's a bit more complicated to elaborate an example to send you. But the way I would do it is with the following classes:
                                  When you create a new receipt you would pull up from PurchaseOrder to find the one you're receiving. Once you set that property you should fill up the full document with the same data where applicable. Each ReceiptDetail should have a reference property of where it came from in readonly mode. Then you can set a validation method like the Date stuff. Because you're only interested before saving the object (something like a pre-validation). The appearance module will highlight on your criteria. So any "changes/differences" in the receipt would be highlighted similarly as in the Patient example. Some criteria for the ReceiptDetails could be something like [POLineRef] is null to highlight the whole row and/or [POLineRef].[Quantity] != [ReceiptQuantity] or something like that.

                                  At the end of the day, your clever users will always find a way to break something in your system. So i prefer the Dx way of preventing a save to the datastore . Whatever you save should be validated well with your biz logic.
                                  Hope it helps. :D

                                • drew.. 02.08.2013

                                  with respect to all involved: the same holds true now as did 5 years ago: validation does not belong in UI code. It belongs where it logicially belongs, not hacked into each area that requires it. Are Chris and i so wrong when we envision this being so seemingly simple at the core? Augment the enums, add warnings and info levels, and simply branch the return if ALL errors are NOT critical ones? Branch to simply continue the save (after offering the user a simple dialog with the offending rules with an OK/Cancel.
                                  This seems simple, but then again, i ain't no Tolis/Dennis etc..

                                • Ralph Rutschmann 02.08.2013

                                  Hi all,
                                  like Eric showed it can't be that hard to implement and that makes me wonder why DevEx is permanently refusing it. Chris gave a few real world examples why it is absolutely necessary to have informations and warnings sometimes not preventing an user from saving data.
                                  > If the company line is that DX are too busy to develop functionality requested 5 YEARS ago
                                  > and argued for by many people then clearly I've attached my cart to the wrong horse.
                                  That sounds a bit harsh but I think you nailed it Chris! :-)
                                  Best regards, Ralph

                                • Chris Royle (LOB) 02.09.2013

                                  @Ralph, harsh would be if I'd said "I think i've attached my cart to the wrong donkey" ;)
                                  There are a couple of solutions presented above, and I appreciate this.
                                  What I'd prefer is if DX implemented the functionality, and supported/migrated the code in future versions - much like the conditional appearance module became part of the DX/XAF code base. Imagine if that had languished as yet another "example".

                                  EDIT: Tolis's stuff does look good btw -

                                • Krzysztof Krzyzsłof 02.19.2013

                                  I have implemented a Web solution for Confirmable validation rules, where user can decide whether to save or not an object with broken validation rule:

                                  Confirmable validation rules mechanism:

                                • Chris Royle (LOB) 02.19.2013

                                  Thanks for sharing Krzysztof.

                                • Dennis (DevExpress) 02.19.2013

                                  @Chris, Drew and others:
                                  First, I appreciate your interest in this particular feature and, more importantly, I would like to thank you for describing real-life scenarios where this functionality would be helpful. While I still cannot promise any ETA for the implementation of this functionality, I should say that when building XAF we were and still are focused not only on providing end solutions (like a ready-to-use extra module), but also on improving the framework core, providing its own extensibility and making it easy to do things that are not part of the framework itself. And I know for sure that preventing the so called "lock-in effect" is equally important as proving ready-to-use "whistles" that can be implemented on their own, probably by using the techniques to which our customers are already accustomed to (e.g., talking here about the IDXDataErrorInfo solution recommended to solve this task with DevExpress editors). At the same time, XAF developers cannot do this for, e.g., Core - Introduce an ability to have two or more classes with one and the same name, but declared within different assemblies, whose implementation involves changes to the XAF core and thus cannot be accomplished without recompiling the source code.
                                  I do agree, however, that it would be helpful to have more such extensibility examples. We will consider covering this particular subject (extending the validation engine) in one of our future blogs. Thanks for the pointer!
                                  Now returning to the donkeys and horses mentioned above. Frankly speaking, if you expect ready-to-use solutions for each business scenario you face with your clients from the XAF team and do not want to write code yourself, extend the framework according to your exact needs, etc., then probably you are really right. The framework will never include the 100% of things you need out-of-the-box and it is absolutely normal for write your own code to fit the remaining percents like you do or did with the traditional development approach (Yes, it saves time as advertised, but does not provide a magic pill for everything). The number of various solutions suggested in this thread (thanks to all contributors!) as well the eXpand Framework that hosts another zillion of solutions just proves this point.

                                • Chris Royle (LOB) 02.19.2013

                                  Dennis I am trying to absorb and distill what you're trying convey; I think it's that I and others have unrealistic expectations and that this request is very specific and an edge case. Us customers expect "magic pills" and do not want to do development.
                                  What we are asking for seems to us a trivial addition/modification to the framework which will improve the XAF product. It's not an edge case, people have demonstrated real world scenarios, it's been hotly debated, etc
                                  If you / DX choose to be dismissive of popular requests, then fine, I can accept that. But don't expect me to recommend or use your products for future projects. Don't expect me to have to rely on 3rd party solutions - even if they are open-source. Also, be honest and don't leave the request open for 5 years - just mark it as IGNORED / WON'T IMPLEMENT or similar.
                                  I've been coding for 30 years and I'm not afraid to roll up my sleeves and use an example or two to satisfy a need. (In fact my code is full of modified examples on how to accomplish things). However my view is that this feature should have been implemented some time ago due to customer pressure and it should be part of the framework. In fact it'd probably have taken less time to debate than to do. Let me say that again in terms that a tools vendor might relate to - if more effort was spent resolving this than debating it, you'd most likely have made a number of customers happier - and they'd be promoting your toolset.
                                  DX are missing a trick by not making use of the real world experience that developers using their products possess.

                                • Dennis (DevExpress) 02.19.2013

                                  Hey Chris, this particular request is realistic and makes sense to me, I am not saying anything against it. I am just saying that it can already be implemented in the current framework version by users who need this feature, although, it would be nice to have it by default, of course. In my personal opinion, it is true and well-understandable, however, that the product is mostly considered as a provider or container of end solutions, and not as a pure framework or a base (that will save you time on implementing the same infrastructure yourself) for your own solutions above it.
                                  It does not make a lot of sense to mark this request as Ignored or whatever, because again it is valuable (see above) and we may return to this ticket in the future.
                                  I think that you also understand that we have many-many other feature requests, and they must be prioritized based on many factors (e.g., taking into account the availability of available temporary solutions). Thank you for your other feedback, which I also understand and appreciate. I am sincerely glad we have a customer like you.

                                • drew.. 02.19.2013

                                  Thanks for the heads up on more to come Dennis, and one again Chris speaks eloquently. I too have countless code augmentations within my xaf apps. And believe it or not, i, and many others, don't come asking for everything we encounter, most of us are professional enough to ask for what we feel are baseline scenarios. My hunch is that if a competitor came along with a similar package with warning validation/a web-facing portal with registration/password retrieval/et al, we would see them very quickly. Like Chris, i am not afraid to code, we simply adopted xaf to handle all the basics for us, which is does moderately well, and for free, we give to you our real-life, in-our-client's-face, blood-sweat-n-tears feedback. Without us selling to our clients you folks would have NO as it exists today.

                                • Apostolis Bekiaris (DevExpress) 05.01.2013
                                • Chris Royle (LOB) 05.02.2013

                                  Thanks Tolis - very helpful.

                                • Chris Royle (LOB) 07.27.2013

                                  For people following this issue, Dennis has been hard at work: