On Thursday, September 18, 2003, at 12:54 PM, Matt Feifarek wrote:
> Randall Randall wrote:
>> I need to create a number of forms that depend on how
>> many objects there are to modify. If there are 3, there
>> need to be 3 forms, one of which will be used.
> This should be no problem; we do it all the time. Just make sure that
> you're using different submit methods (actions) for each one.
That seems tricky; I'd had every form using the same submit method
and the method was cycling through every form in self._forms to
find the successful one that had called it.
So, to do this, I'd need to define a generic method and use
setattr to set the name of each copy to the name of the
submit button as it's generated?
>> At first, my servlets were creating extra forms for
>> each form I create in awake() on every refresh of the
>> page. This suggests that the forms themselves were
>> persisting through sleep(), so I added a statement to
>> delete self._forms, but now the form never seems to be
> There is a reset forms method that is typically called from sleep()
> (but can be called by you whenever you like)-- make sure that you
> haven't accidentally removed it.
I use the FormKitMixIn, and self.resetForms() , but my
problem hasn't been the contents being uncleared, but
extra forms. That is, if I use
f = Form.Form()
in awake(), the second load has two forms dumped by
for form in self._forms:
wr( form.dump() )
and the third time I reload the page, I have three
forms on it, etc. I hope that using different submit
methods, as mentioned above, fixes this. :)
>> Is there a right way to handle variable numbers of
>> anonymous forms with FormKit, or should I try to
>> shove all possible objects into one form?
> Look in the examples for the "MultiFormExample.py" and follow that
Those are named forms, though. The example didn't seem
to apply for a variable number of forms, only a static
Randall Randall <randall@...>
"When you advocate any government action, you must first
believe that violence is the best answer to the question
at hand." -- Allen Thornton