> > I am trying to manage this in the 'process()' member of class derived
> > from 'Form', adding the new widgets there. I did not have success,
> > even though I tried many different possibilities...
>
> Try doing it in the __init__ of the class, with logic something like this
> (typed from memory, so there are likely to be errors):
>
> def __init__ (self, request):
> Form.form.__init__(self, request)
> self.add_widget("submit_button", "add", ...)
> if self.get_widget_value("add"): # XXX not sure this is the right
> check
> self.add_widget("string", "fieldname", ...)
I tried it, but it didn't work (yet)... For using something like
'self.get_widget_value()' on a button, I think that I would need a
'request' as an argument, right? (And then I would expect to use
'get_submit_value()' to access the value of the button pressed).
Otherwise, it will always have the value given on the construction; if
I create it with
self.add_submit_button("add", "Add a new name")
then
self.get_widget_value("add")
will always lead to "Add a new name" (at least inside '__init__()')
> Note that Quixote comes with a List widget for having a list of
> identical subwidgets; the user can add new ones so they can enter an
> arbitrary number of items, and I think blank fields get forgotten,
> so you may not need to do this dynamic widget creation yourself.
I still did not figure out how to used the ListWidget... Could you
please send me an example?
Thanks,
Pedro
--
Joao Pedro PEDROSO jpp@ncc.up.pt
Faculdade de Ciencias da Universidade do Porto
Departamento de Ciencia de Computadores
R. Campo Alegre 823, 4150-180 Porto, Portugal
Tel: (+351)226.078.830 Fax: (+351)226.003.654