New Posts New Posts RSS Feed: A complicated validation scenario
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

A complicated validation scenario

 Post Reply Post Reply
Matthew View Drop Down

Joined: 31-Jul-2007
Posts: 14
Post Options Post Options   Quote Matthew Quote  Post ReplyReply Direct Link To This Post Topic: A complicated validation scenario
    Posted: 08-Jul-2008 at 5:01pm
At least its a bit complicated from my point of view, but I was hoping I could get some advice on how to handle it.

I have a business object "Customer" with fields like "Status", "AccountRep", and "SupportLevel."  There are several rules associated with Customer including the following two:
1. If Status = "New", then SupportLevel must = High
2. If Status = "New", then AccountRep cannot be null

In the GUI, Status is bound to a ComboBox.  When the user chooses "New" from the ComboBox is where my problem begins.  "New" is a valid choice for Status, so if AccountRep field is null, the rule is broken.  Status should not display an error, however, AccountRep should, but the rule really should be fired when Status is changed (I want to show the user visually when he changes the Status that he mush fill out AccountRep also).  And the rule should also be applied (in reverse I guess) when the user changes the AccountRep comboBox.

I guess my question is how to handle a situation where one field fires the rule, but the error should be displayed on another field?

If any of that needs clarification, please let me know :)
Thanks for any insight,

Back to Top
GregD View Drop Down

Joined: 09-May-2007
Posts: 374
Post Options Post Options   Quote GregD Quote  Post ReplyReply Direct Link To This Post Posted: 09-Jul-2008 at 10:56am
Any rule involving more than one property should be applied only at instance validation, not in response to the setting of an individual property (pre- or post-set validation). In other words, the values of the two (or more) properties that are involved in the rule should not be tested for correctness until you are validating the entire object. This permits either value to be set freely, independently of the other; but the freedom ends when the instance is validated in its entirety.
Greg Dunn
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down