This is a migrated thread and some comments may be shown as answers.

RadDataForm custom validation results

8 Answers 93 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 16 Oct 2015, 05:34 AM

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);
      }

8 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 20 Oct 2015, 04:12 PM
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
0
John
Top achievements
Rank 1
answered on 20 Jan 2016, 01:12 AM
Thanks Ivan for your positive response and for the points. However is there any chance of actually getting this implemented?
0
Ivan Ivanov
Telerik team
answered on 22 Jan 2016, 04:20 PM
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
0
John
Top achievements
Rank 1
answered on 27 May 2016, 01:35 AM
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?
0
Ivan Ivanov
Telerik team
answered on 31 May 2016, 02:57 PM
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.
0
John
Top achievements
Rank 1
answered on 03 Aug 2016, 12:57 PM
Any update on this?
0
Stefan
Telerik team
answered on 08 Aug 2016, 11:58 AM
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.
0
John
Top achievements
Rank 1
answered on 03 Nov 2016, 09:14 AM
Just updated to 2016.3.1031 and can see this is finally implemented. Thank you!
Tags
DataForm
Asked by
John
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
John
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or