Mike,

I'm afraid that we've never used Cheetah, so I can't really comment much on
your code.

We're certainly interested in added features to FormKit to accomodate
Cheetah, PSP, etc. I've got to read up on Cheetah anyway, so maybe this is a
good time for me.

If after you read more about FormKit, you've got some ideas of things that
need to be changed or added, by all means, send them along.

| -----Original Message-----
| From: Mike Orr [mailto:[EMAIL PROTECTED]]
| Sent: Wednesday, April 17, 2002 6:18 PM
| To: Matt Feifarek; Ian Bicking; Tavis Rudd
| Subject: FormKit and Cheetah
|
|
| You mentioned more Cheetah compatibility in the Quick Start.  From a
| brief look, what's needed is to be callable from a template servlet.
| If somebody can just put
|       $processForm
| in their servlet, that would be sweet.  That would be a user-defined
| method that (if no input) returns the form HTML, or (if yes input)
| processes/validates the input and returns a success message or the form
| again.

Seems like a template servlet for Cheetah should be written. Good point.

| It's desirable that the template servlet *not* inherit FormKit, but
| instead use a Form object in the ProcessForm method.  That way we avoid
| possible unintended interactions between the various base classes in the
| template servlet (including the user's base classes).  However, then the
| issue becomes, how does the FormKit object call into the AppServer to
| get its input?

There's an example or two of that in the examples: NoMixinExample and
NoMixInExample2.

Basically, you just call form.process( data ) where data is the dictionary
of input.

| If it's possible for the processForm method to instantiate and use a
| Form object and return the output, then we can prob'ly integrate the two
| without changing FormKit.

Should be fine.

| There may be issues between template servlets vs multiple submit
| buttons (multiple actions) and/or multiple forms.  I'm not sure how
| Cheetah uses the .action() method, or whether it just passes it through.
| The Form object may need a method to call the action itself.

Right now, the Form object doesn't even know about the action methods; it
leaves all of that logic to the servlet. It just eats data and compares it
to its membership and their validators. FormKit shouldn't interfere with
standard action() behavior at all.

You could certainly NOT use actions in FormKit, with a simple test anyplace
after awake()

if form.isSuccessful():
        methodToCall()
else:
        pass

| Can the user use a form like this?
|
| from FormKit import Form, Field, ...
| class myPageLogic:
|       """Methods/attributes for the template servlet myPage."""
|       def processForm(self):
|               f = Form(...)
|               f.addField( Field(...) )
|               inputData = self.fields()
|               return process(inputData)  # Return the form HTML or
|                                               success/error message.

Sorta. Everything looks good, but process() doesn't return anything.

What you would do is:

                process(inputData)
                if form.isSuccessful()
                        formValues = form.values()
                else:
                        errors = form.errors()



_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to