11 messages in com.googlegroups.pylons-discussRe: Retrieving multiple similar value...
FromSent OnAttachments
voltron25 Sep 2007 03:15 
Clemens Hermann25 Sep 2007 03:28 
voltron25 Sep 2007 03:40 
voltron25 Sep 2007 03:46 
James Gardner25 Sep 2007 03:54 
Clemens Hermann25 Sep 2007 05:13 
voltron25 Sep 2007 06:57 
Clemens Hermann25 Sep 2007 07:19 
voltron25 Sep 2007 07:28 
Clemens Hermann25 Sep 2007 08:03 
voltron25 Sep 2007 08:29 
Subject:Re: Retrieving multiple similar values from request.params
From:James Gardner (jame@public.gmane.org)
Date:09/25/2007 03:54:46 AM
List:com.googlegroups.pylons-discuss

Hi voltron,

I wrote a blog entry about this here: http://jimmyg.org/2007/09/19/multiple-checkboxes-with-formencode/

Basically you use a custom Schema in a ForEach validator and then use a NestedVarables pre-validator to decode the data to a list. You then need to re-encode it before using HTMLfill to re-populate your form. Your form template needs to name the variables in the correct style so that FormEncode can decode them correctly.

The blog entry starts off talking about checkboxes but the bit you need is slightly further down. I'm writing a chapter for the Pylons book about this at the moment so if you need more info let me know and I'll send you the draft off-list.

Cheers,

James

voltron wrote:

Checking up the docs, I really, really would how this works, it would be "magic". variable_decode, according to the docs, would take a list char for decoding into lists, the default is list_char='-', How would that work in my case? I could use a code snippet.

Thanks!

On Sep 25, 12:28 pm, Clemens Hermann
<clh...-gM/Ye1E23mwN+BqQ9@public.gmane.org> wrote:

On Sep 25, 12:15 pm, voltron <nhy...-gM/Ye1E23mwN+BqQ9@public.gmane.org>
wrote:

I have asked about something like this before, this is similar but more complicated:

I have answered about something like this before, this is similar and the solution is the same :)

academic_from_year0, academic_till_year0 e.t.c academic_from_year1, academic_till_year1 e.t.c academic_from_year2, academic_till_year2 e.t.c

http://formencode.org/module-formencode.variabledecode.html

hth,

/ch