Ticket S19476
Visible to All Users

Validation - Check validation rules when input focus changes

created 17 years ago (modified 10 years ago)

UPDATED by Dennis:
Typical user scenarios (for better discoverability):
T284797"however your solution is for when the user attempts to save the record.  I want the warning to occur when the user attempts to tab out of the product field. "

T238222"I want to run the module validation when a field loses focus, besides running to save the record, how can I do that?"

Q511579: "I want to validate immediately after user enter values and if it's wrong I want to prevent switching to next control until user corrects the value."

Q428483: "I would like to execute an action (i.e. validate the data of a field) when leaving the field as opposed to validating onSave or onDelete. I know I can make custom contexts for validation"

Q305885: "Now, I have a requirement to check this value immediately after it has been inserted (in DetailView) and not wait for "Save"."

Q98804: "I would like to perform contextual validation in a custom context. Specifically when the user moves focus from a control (check that bound properties rules and show an error if any of them are violated)"

Answers approved by DevExpress Support

created 9 years ago (modified 7 years ago)

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.

Additional information:

Data validation now occurs immediately after the input focus changes if the validation rule evaluation does not require querying additional data from the server. These rules are RuleRequiredField, RuleRegularExpression, RuleStringComparison, RuleValueComparison and RuleRange.


The in-place validation is enabled for the Save context by default. To enable it for other contexts, use the AllowInplaceValidation property of the Validation | Contexts | Context node in the Model Editor.

As the rule evaluation occurs at the client side, the in-place validation does not occur when:
 the rule's target property is the collection, image or reference property;
 the ParametersMode type parameter passed to the RuleRange or RuleValueComparison attribute is set to Expression;
 the RuleBaseAttribute.TargetCriteria is specified.

When a property is decorated with the RuleRequiredField  attribute, ValidationModule appends a symbol to the editor of this property that is stored in the IModelLayoutManagerOptionsValidation.RequiredFieldMark  property.
By default, the Solution Wizard sets the RequiredFieldMark property to '*' (an asterisk symbol). You can change it using Model Editor.

The in-place validation engine relies on Controllers provided in the platform-specific ValidationWindowsFormsModule and ValidationAspNetModule modules. The ASP.NET module is introduced in 15.2. So, to use the in-place validation after upgrading your existing ASP.NET applications to 15.2, add  this module from the Toolbox in the Application Designer.

    Show previous comments (3)
    Dennis Garavsky (DevExpress) 9 years ago

      @Chris: Thanks for your feedback. We look forward to hearing from you once you have had a chance to test this in your real project. We will also take your current input into account.
      @Paul: Yes, it also works with editable Grid List Editors for both platforms.

      DevExpress Support Team 9 years ago

        @Paul: By the way, the Batch Edit Mode is supported as well.

        P P
        Paul van Keulen 9 years ago

          Thanks for the update!

          created 10 years ago (modified 10 years ago)

          Sometimes it is necessary to perform validation when some event is executed (for example, when a control loses focus).
          Use Access Editor Settings to access an editor and use its Validation functionality. This functionality will also prohibit moving focus to another control in case of invalid input. This approach is illustrated in the Solution.Module.Win/ControlValidation.xx file.

          It is possible to perform XAF validation using RuleSet methods described in the Implement Custom Contexts article, which will trigger validation without throwing an exception and show an error via the control's functionality.This approach is illustrated in the Solution.Module.Win/XAFValidation.xx file.

          See also:
          Validation Module Overview
          Validator
          Non-Persistent Objects Validation

            Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

            Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.