Business objects and wizard UIsBusiness objects and wizard UIs
Old forum URL: forums.lhotka.net/forums/t/176.aspx
ajj3085 posted on Tuesday, May 23, 2006
Hi all,
I have a BO and a UI which makes most sense as a wizard.
As the user enters data in the UI, the BO becomes 'more valid,' so to speak. Each page in the wizard allows users to enter data, and when that page has been filled out, they should be allowed to move on to the next.
Currently i have several IsPageXValid properties. Each one of those will only look to make sure the rules for certain properties are valid, ignore other rules. The wizard binds the "Next" button to the appropareate IsPageXValid property as the user moves through the wizrard.
I'm not sure I like this setup though; for one it doesn't seem to work reliably (for some reason one user can run the program, and go through the wizard fine, but another user, attempting to enter the EXACT same data, the wizard fails to enable the Next button). Also, those properties limit how I build the wizard; they seem too UI centric.
I was wondering what others though; am I over-engineering this? How could I give the UI enough information to decide if enough of the rules are statisfied to allow the user to move to the next step?
Thanks
Andy
phowatt replied on Tuesday, May 23, 2006
I use a technique for my forms whereby I use an error provider and a naming convention that allows me to build a routine that scans the control collections of a form and the broken rules collection. I first check to see if the form control binding count is greater than zero. My naming convention for Text Boxes for example is to attach the prefix 'txt' in front of the property name from the business object. If I find a control that is bound I then strip the first three character names from the control name and then scan the brokenrules collection for a match. If I find one I then set the error provider message for that control to the message from the broken rules collection. I would think that you could scan the controls from the current form in your wizzard and if any of those bound controls had a match in the broken rules collection you could set the error provider message for that control in that form. If you found any for than form you could disable the Next button until that form had no error messages.
Just a thought.
ajj3085 replied on Tuesday, May 23, 2006
Thanks, thats an interesting approach. I'll certainly look into it.
xal replied on Tuesday, May 23, 2006
Ok, so you different sets of data (one per wizard screen) living toghether in a bo. They're all mixed up there with the rules and all and you're having a hard time checking if a determined group of data is valid.
How about making each group of data a child object? (With no collection) Each with it's own properties and rules.
Then each form (or wizard screen) will bind it's controls to a child object and you can check the child's isvalid before passing to the next screen.
The root's IsValid would contain calls to the children's IsValid. The root can also contain rules that check values across children...
Andrés
Copyright (c) Marimer LLC