remi jolin, el 17 de febrero a las 11:12 me escribiste:
> 
> Leandro Lucarella a écrit :
> > Hi! I want to set the options of a MultipleSelectField at 'display time'
> > but I couldn't find how to do it.
> >
> > I have something like this:
> >
> > form = TableForm(fields=[MultipleSelectField(name='stuff', ...), ...], ...)
> >
> > And I want to do something like:
> > form.display(stuff_options=[(x, x) for x in object.my_xs])
> >
> > The important thing is I can't use a simple callable and set the options
> > at 'creation time' because the 'object' changes from request to request.
> >
> >   
> I had a similar issue with a RadioButtonList where I wanted to setup the 
> options at render time.
> What I did is subclassing the RadioButtonList widget and only change the 
> template replacing options by dyn_options.
> Then at render time (and creation time) I use dyn_options instead of 
> options. If I understood what happens, options is filtered by the 
> widgets mechanism at render time. Any other name is not, so it works.
> I think this method can be duplicated to your case and then you'll make 
> calls like

Thanks, I'll try that. Is there any particular reason why options is
filtered? Is not a common case to override the options at display time?

> form = TableForm(fields=[MyMultipleSelectField(name='stuff', ...), ...], ...)
> 
> form.display(dyn_options=dict(stuff=[(x, x).....

This is another thing I don't completely understand. How to pass options
to inner widgets. I can't find any good exaplanation of the mechanism in
the (rough) docs. In this case, how does the form know where to 'forward'
the dyn_options? It 'forward' it to all inner widgets?

-- 
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
 .------------------------------------------------------------------------,
  \  GPG: 5F5A8D05 // F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05 /
   '--------------------------------------------------------------------'
Dentro de 30 años Argentina va a ser un gran supermercado con 15
changuitos, porque esa va a ser la cantidad de gente que va a poder
comprar algo.
        -- Sidharta Wiki

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to