Attachment: ex-formkit.tmpl
Description: application/text



Okay, attached is an example of using Cheetah and FormKit. It's not especially elegant, I just whipped it up. I don't like using the FormKit mixin, nor do I use WebKit actions. I feel they hide how things work. So this is not the way everybody uses FormKit, but I think it's cleaner.

The first time awake() is called, it initializes the form.
Then the "bulk" of the web page is processed and it includes a chunk of code in the middle that processes the form, and does three things depending on the state:
(1) No data submitted so user wants a new form
(2) Data has been submitted but there are validation errors
(3) Data submitted and it was successful.
For each state, it writes out form, error messages with the form, or a thank message as appropriate.

That's it.

-winston

On Feb 9, 2005, at 9:29 PM, jacob martinson wrote:

I'm new to all this stuff too so I may be way off here... any
corrections are appreciated...

I haven't been able to figure out a clean way to use FormKit and
cheetah templates together, and after I played w/it for a while, I
realized I couldn't even figure out how I would _want_ it to work if
it did.

If your cheetah template contains the definition of how your form is
rendered, FormKit isn't going to know how (or be able?) to insert
messages about invalid input entries. You could still use FormKit's
validators and interface with a Form object from within your cheetah
template, but I think that would get ugly. I like to keep my use of
the templating language to a miminum.

Or maybe you can follow the form processing part of the cheetah users
guide and instead of doing your own validation just make calls to
FormKit's validators from a separate python class you write like in
FormKit/Examples/NoServletExample.py.

But then you are defining the form in two separate places, which would
be annoying.

What I'm doing right now is I have the form/html coming from a
compiled cheetah template, and I have a separate webkit servlet (just
extending Page) that does input validation and any backend work
associated with the form.

If there are errors either in the form's input or in doing the backend
work, I redirect back to the form with an error code set as a GET
field. The form template imports a python text file that contains a
dictionary of all the error codes and their associated messages and it
outputs the msg to the user if the GET field is set.

I really don't want to be generating html manually from w/i my
servlets and this is the best way I have figured out to do it so far.

-jacob

On Fri, 04 Feb 2005 21:21:54 +0100, DeHa <[EMAIL PROTECTED]> wrote:
Hi all,

I'm quite new to webware and other mentioned tools. I want to use them,
but I cannot find tutorial for use all of them together. The best way
will be to see real world example, but I can't find any by googling.
could anyone point me to any resource in these case?

Pozdrawiam / Best regards
--
Dawid Hulisz
also known as DeHa

"Always look at the bright side of life" - Monty Python

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss


_________________________________________
winston wolff - (646) 827-2242 - http://www.stratolab.com - learning by creating

Reply via email to