On Wed, 2003-01-08 at 19:35, Edmund Lian wrote: > Before I abandoned my design, I had something much simpler: > > class MyForm(Form): > def createForm(self): > self.addField(TextField("myTextField", ...)) > self.addField(IntegerField("myIntField", ...)) > self.addButton("buttonName", ...) > > The advantage of this is that you could add fields and buttons to MyForm > very easily on-the-fly, and you could also control the generation of fields > even during instantiation via code in the createForm() method.
This looks similar to FormKit, from what I remember, and is a design I specifically chose not to use. It certainly is easier to hack out a page that way -- it's very imperative, and easy to think out, and I can appreciate that. But more and more I want to think of the form as an interface, and an interface only makes sense when it's declarative. Part of the advantage of a class definition is that it's a declarative style people are used too -- as it is now you might almost imagine it's imperative, but it's not, and I imagine that disconnect frustrates people. CherryPy I believe uses class definitions, though I haven't looked closely at it. Formulator is all crazy because it's in Zope. I haven't looked around at other form generators in a while, but back when I did I didn't see much that excited me. > Also, unlike your Form class, mine did not attempt to extract and deliver > data to each field from the request stream. It just passed the transaction > object to each field, and each field was responsible for extracting what it > needed, as well as casting data to the appropriate data type. That's actually what FFK does, more or less, but since most fields just take out a single value I factored most of the logic into the Field class, and more complex fields can override the necessary methods to grab more information from the request. Ian ------------------------------------------------------- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com _______________________________________________ Webware-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-devel