There now appears to be a lot of activity in this area. Data binding, Validation, and now visibility has been raised so far. We've also seen inter-field dependent calculations (Ian's @Calculate) I would strongly urge contributors on this list to take a good look at XForms before reinventing the wheel, see http://www.w3.org/TR/xforms11/#model in particular.
XForms defines for each piece of bound model data, a set of things called "model item properties" These properties encompass dynamic calculations that control validation, visibility, requirement, readonly, and computed field value. A given UI widget in XForms, when bound to a model node, changes its UI in response to the recalculation of these model item properties whenever the form changes. For example, let's say you have an internationalized Address entry form that contains entries for US postal addresses, but when someone chooses a country other than "US", some other fields become visible. In XForms, you'd simply place a "relavent" model item property on these hidden fields that check if the country != USA. Or, you could have a field that may or may not be required (can't be left empty or in default state) dependent on data or choices in other fields. Likewise, validity can be simple (based on XSD datatype conformance) to complex (mathematical expression evaluating to boolean) Fields can become editable or readonly based on other fields as well. Now, I'm not suggesting that we adopt XForms for GWT, since there is alot in the spec that makes it heavyweight. However, once we start adding annotations for Validity, Calculated, and Visibility, we may as well add those for ReadOnly and Required as well. I built applications using the XForms model as well as one of the early processor implementations, and my experience was very positive. XForm's form processing model brings Spreadsheet-like ease to setting up very complex web forms, and so I think people should give it a look for inspiration, when attempting to devise an advance forms framework for GWT. -Ray On Wed, Oct 8, 2008 at 1:42 PM, Arthur Kalmenson <[EMAIL PROTECTED]> wrote: > > As I mentioned before (http://groups.google.com/group/Google-Web- > Toolkit-Contributors/browse_thread/thread/b696e7319fc6bea/), I'm > looking to contribute our project back to the incubator as I refactor/ > rebuild it. One of the main things that we were looking to simplify > was visibility management. > > In our particular use cases, almost every application we build has a > relatively extensive form with complex visibility logic. For example, > if the user presses "Yes" on a radio button, another few fields open > up and they fill those fields out. The way that this logic is > currently done in GWT is through listeners and a lot of manual work. > The module that we created was suppose to simplify this. Here's what > we have so far. > > We have something called a FormatPanel that allows you to make calls > like showIfSet(Widget a, Widget b, VisibilityRule rule). The > VisibilityRule sets listeners and so receives events from widgets a > and b. It then determines if widget "b" should be shown depending on > the value of widget a. There is also a hideIfSet() method. > > Does this approach make sense? Let me know what you think. I'll > continue updating this part of the project and I'll try to post some > code and more concrete examples in the next few days. I'm just > wondering if the approach makes sense to people. Thank you. > > Regards, > Arthur Kalmenson > > > --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
