On 10/6/05, Yesh <[EMAIL PROTECTED]> wrote:
>
> Thanks for the reply.  I did read the SQLObject docs and the Kid
> template. I was using Cheetah before.
>
> What I would like to know is how to name
> the form variables for the invoice items so that I can commit it
> automatically.

Using CherryPy, you can name the variables the same and then you'll
get lists in. For example,

<input type="text" name="foo" py:for="foo in foos"/>

Will give you an input field for each item in the list. In your
controller method:

def updatefoo(self, foo):
    if not isinstance(foo, list):
        foo = [foo]
    for i in range(0, len(foo)):
        do whatever it is you do with foos

The thing to watch out for is checkboxes, because the browser doesn't
send a value for unchecked checkboxes.

I just thought I'd point this out in case it works better for you for
this particular problem. The FormEncode route should work well as
well.

Kevin

Reply via email to