Search This Blog

Saturday, July 27, 2013

Developing the validation warnings feature - Feedback is needed!

You probably saw my recent post about the feature we are developing for 13.2. This nice addition to the framework was welcomed by the XAF community and there were some questions from customers which I would like to answer here. So, let's do it!

Q1: Chris G. Royle It's difficult to see from the screenshots how you've implemented Dennis. If you've used the snippet that Tolis posted recently in a blog,
A1: No, we have not used the eXpand Framework implementation.
Take special note that a validation warning rule is declared as follows:

[RuleCriteria("RuleWarning", DefaultContexts.Save, @"IsWarning = false", SkipNullOrEmptyValues = false, ResultType=ValidationResultType.Warning)]

You can learn more about our implementation from these short videos:

Winforms:  Unable to display content. Adobe Flash is required.


Q2: Chris G. Royle Also, how does this affect validation called in code (not at a PC) ?
A2: Currently, broken validation warning rules are treated the same way as regular broken validation error rules.
Technically, that means that if I use the following code:

var obj = ObjectSpace.FindObject<ValidationErrorsAndWarningsFeatureObject>(CriteriaOperator.Parse("!IsError && IsWarning"));
RuleSetValidationResult result = Validator.RuleSet.ValidateTarget(ObjectSpace, obj, "Save");
System.Diagnostics.Contracts.Contract.Assert(result.State == ValidationState.Invalid);

The result.State will be Invalid. Refer to this video for more details on this. I feel that this is something you may want to customize to achieve a different behavior (e.g., have something like ResultType to know whether it is an error or warning). So, I wanted to hear from you on this as well.

Q3: Chris G. Royle it'd be useful to implement information items as well, which would be consistent with idxerrorprovider (iirc).
A3: Yes, we considered this as well, but have not yet included this functionality into the standard delivery, because we had some questions concerning the default behavior. For instance, the validation information rule can be declared as follows:

[RuleCriteria("RuleInformation", DefaultContexts.Save, @"IsInformation = false", SkipNullOrEmptyValues = false, ResultType=ValidationResultType.Information)]

That's all clear, but it is not clear how this should be rendered in the UI (I am not talking about the information icon near the editor). Currently, warning messages are listed in the dialog with other errors and you can skip by pressing the Ignore button in the dialog. 

Do you want exactly the same behavior for information messages?

I appreciate your feedback in this regard. Also, let me know if you have other suggestions and considerations.

1 comment:

  1. Please consider the situation where the control is placed on a tabbed group of a large form.