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

Disabling validation?

1 Answer 133 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 25 Oct 2012, 10:56 PM
I have a RadDataForm that is bound to a heterogeneous collection. I'm using a DataTemplateSelector to select an appropriate DataTemplate for each Item, as it becomes current.

There is, of course, a different template for each type of item, but they all share some bothersome properties:
  • They all include a large number of controls
  • They all include a large number of validation rules
  • They all include many validation rules that operate between controls or on groups of controls.

As an example, each template has a three or more GroupBoxes, and validation rules that require that at least one checkbox in group A and at least one checbox in group B be selected, unless a checkbox in group C is selected, in which case all of the fields in groups A and B must be cleared.

The resulting rules were complex to construct, but they work correctly, now, when the form is being edited. The problem is when the form is being viewed.

When the form is open in view-only mode, and I navigate from one item to the next, using the prev/next buttons, it's taking more than a second for the new item to be displayed. And that's entirely unacceptable.  I've been digging into it, trying to identify where the time is being spent, and from what I can see the largest part is in the validation code. All of these fields are validating against each other, this checkbox is checking to make sure that that field is not empty, this groupbox is checking to see that it has at least one checkbox checked, and that the other checkbox does not, etc.

And what's really aggravating is that none of this is necessary. Even if the data in the database were somehow incorrect, when it is loaded into the form in view-only mode, I'd not want to display validation errors.  What is in the database is what is in the database, regardless of what it is. Validation should be occurring only in edit mode.

So, is there a way to turn off the validation checks? To load the data without running the validation checks?

1 Answer, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 30 Oct 2012, 04:06 PM
Hello,

Currently it is not possible to surpass the internal validation logic. However, there are certain scenarios when validation in read-only mode would be useful. In order, to meet the requirements of both cases, we decided to implement a mechanism, similar to RadGridView's ValidatesOnDataErrors property. We will do our best to include this in the incoming service pack.

All the best,
Ivan Ivanov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
DataForm
Asked by
Jeff
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Share this question
or