RadDataForm custom validation results

9 posts, 0 answers
  1. John
    John avatar
    10 posts
    Member since:
    Aug 2011

    Posted 16 Oct 2015 Link to this post

    Hi,

     It would be extremely useful to have an virtual method that is called during the form's Validation process, that could be overridden ​to provide custom validation results to be injected into the ValidationSummary in place of the form's own validation. I've taken a look at some of the code and something like the following would be great. This is a small change to the existing code which I don't think would have any impact on other existing functionality:

        /// <summary>
        /// Checks if data current item is valid .
        /// 
        /// </summary>
        /// 
        /// <returns/>
        public bool ValidateItem()
        {
          CollectionExtensions.RemoveItems<ErrorInfo>((ICollection<ErrorInfo>) this.validationErrors, (IEnumerable<ErrorInfo>) new List<ErrorInfo>(Enumerable.Where<ErrorInfo>((IEnumerable<ErrorInfo>) this.validationErrors, (Func<ErrorInfo, bool>) (ve => ve.IsItemLevelValidationError))));
          List<ValidationResult> validationResults = new List<ValidationResult>();
          if (this.CurrentItem != null)
          {
            try
            {
              validationResults.AddRange(GetValidationResults())
            }
            catch
            {
              return true;
            }
          }
          CancelEventArgs e = new CancelEventArgs();
          this.OnValidatingItem(e);
          if (e.Cancel)
            return false;
          this.PopulateValidationErrors(validationResults);
          return !EnumerableExtensions.IsNotEmpty((IEnumerable) this.validationErrors);
        }

          protected virtual IEnumerable<ValidationResult> GetValidationResults()
          {
              Validator.TryValidateObject(this.CurrentItem, new ValidationContext(this.CurrentItem, (IServiceProvider) null, (IDictionary<object, object>) null), (ICollection<ValidationResult>) validationResults, true);
          }

  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1127 posts

    Posted 20 Oct 2015 Link to this post

    Hi John,

    This sounds like a great improvement in terms of usability. We will do our best to research it for the future releases of our controls. I am adding 1000 Telerik points to your account.

    Regards,
    Ivan Ivanov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
  4. John
    John avatar
    10 posts
    Member since:
    Aug 2011

    Posted 19 Jan in reply to Ivan Ivanov Link to this post

    Thanks Ivan for your positive response and for the points. However is there any chance of actually getting this implemented?
  5. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1127 posts

    Posted 22 Jan Link to this post

    Hello John,

    Since it will improve the usability of RadDataForm, we will do our best to include the feature in the next official Q release (Q2 2016).

    Regards,
    Ivan Ivanov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  6. John
    John avatar
    10 posts
    Member since:
    Aug 2011

    Posted 26 May in reply to Ivan Ivanov Link to this post

    Hi Ivan, I just checked in version 2016.2.525 and this still hasn't been done. You previously said it was targeted for 2016.2.x. Any chance of getting this done soon?
  7. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1127 posts

    Posted 31 May Link to this post

    Hi,

    I am afraid that we did not manage to add it for the official release, so we left it for the next one. In case that we finish it earlier and we are confident that we can release it in an internal build, I will drop a line in this thread.

    Regards,
    Ivan Ivanov
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  8. John
    John avatar
    10 posts
    Member since:
    Aug 2011

    Posted 03 Aug in reply to Ivan Ivanov Link to this post

    Any update on this?
  9. Stefan X1
    Admin
    Stefan X1 avatar
    518 posts

    Posted 08 Aug Link to this post

    Hello John,

    Please excuse us for the delay.

    I can ensure you that this feature request is planned for our next official release.

    Thanks in advance for your understanding.

    Regards,
    Stefan X1
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  10. John
    John avatar
    10 posts
    Member since:
    Aug 2011

    Posted 03 Nov in reply to Stefan X1 Link to this post

    Just updated to 2016.3.1031 and can see this is finally implemented. Thank you!
Back to Top
DevCraft banner