|
From: Luke O. <lu...@me...> - 2003-03-29 23:51:36
|
Hello all -
Putting in some quality Saturday work musings, I've come up
with a couple issues for FunFormKit (0.4+)
First, a tiny bug: Field.py line, ImageSubmit class, htInput
method: the html.input attrs has "src" misspelled as "srg".
I'd also like ImageSubmit to take an option "imgSrc" to
override the initial imgSrc. (This is required for us when
we have a form that is rendered across a site, in varying
directories and dir levels.) So here's my revised
ImageSubmit.htInput:
def htInput(self, default, options, nameMap=identity):
return html.input(
type="image",
name=nameMap(self.name()),
value=self.description(),
src=self.option('imgSrc', options=options,
default=self._imgSrc),
height=self._imgHeight,
width=self._imgWidth,
border=self._border)
Second, completely unrelated: the recurring problem of
rendering two separate forms on the same page at the same
time. We believe we have a solution! :)
The setup: two separate formdefs, rendered in different
parts of the page, so we have "writeFirstForm(self)" and
"writeSecondForm(self)", which each want to call
self.processForm and then go on to "renderFirstForm" or
"renderSecondForm", or print out a success message. The
problem is that processForm should in this case only process
the form that's being handled then (we don't want to call it
for the same form twice in a page, and end up adding two
orders etc).
So, we'd like to add an optional named argument to
processForm, which will be the name of the form to process
if possible. If the submitted form (if any) doesn't match,
processForm will return (False, 'noform'), just as it does
when there is no form at all submitted.
This shouldn't break any existing code, and gives more
control to the servlet. Snippet of new processForm:
def processForm(self, transaction=None, formName=None):
...
if not currentForm:
return False, 'noform'
if formName and currentForm.name() != formName:
return False, 'noform'
...
Comments appreciated,
- Luke
|