I'm having some problems with validation in new records in my winforms project. In most of the tables of my database, I have at least one value which I am not allowing to be blank. I have written rules, either into the entity layer, or the service layer, to enforce this.
The problem I'm having, is when I create a new record and try to edit it, these rules are getting in the way. The basica workflow for creating a new record is:
1) Click on an "Add New" button.
2) New record is created.
3) A card (detail) view form is opened up where the user can edit it.
The problem is, when the card opens, the validation rules for entity have kicked in. And seeing as though all of the fields are empty (it is a new record afterall), some of the fields are in error. As I'm using the ErrorProvider control (with the flashing red dot thing on), several fields have the red error dot next to them as soon as the user opens it up.
Is there some way around this? I'd prefer if the fields in the new entity are not valided until they are modified, and the whole thing when the user tries to save it.
I'm not 100% sure, but from memory NetTiers did not always behave like this.
I'm trying to think of a work around, and the best one I can think of so far is to turn the flashing red dots off (on the ErrorProvider control). But I'd prefer if I had great control over the entities themselves.
Thanks.
---- EDIT ----
I have had a bit more of a think about this, and the work around I thought of (turning off flashing red dots) wont work. If the user clicks into an empty field (which is in error, as it wants a value), it still wont let them leave. Very annoying.
Idealy what I would want is:
1) New record is created with no errors.
2) As fields are modified, that field only is validated (other fields which might be invalid dont effect it).
3) When the user goes to save the new record, all validation rules are taken into account.
Any assistance in acheiving this would be appreciated.