Edmund Lian wrote:
> On 01/11/2003 01:42:12 AM webware-discuss-admin wrote:
>
>>There appears to be a bug in SelectField in the Field.py
>>file in FunFormKit, such that defaults are not properly
>>carried through an error condition, unless they are strings.
>
> Not sure if this is a bug or a feature... but the docs (pp 9) says that if
> a field is dynamic "All keys must be strings, and only strings will be
> returned". So, there's a good chance that your key values are not being
> handled correctly. My suggestion is to just set and expect strings. In any
> case, everything coming back from the browser is a string...
Yes, looking at how SelectField handles non-dynamic selections seems
to confirm what you say. :( That suggests that it would be useful
to alter SelectField so that even dynamic selections were converted
to strings, as otherwise we have the situation of getting integers
from a source (such as a database), converting them to strings, and
expecting them to return from the validators as integers. One of
the things I like about FunFormKit is that it normally doesn't matter
whether form values are strings, integers, lists, etc, as long as I
use the correct validatorConverter.
I've not really figured out how to use FFK most effectively yet,
actually. Typically I need either very flexible forms that shrink
and grow (for instance, as items are added and subtracted from a
shopping cart), or lots of little forms that do one thing.
Oh, by the way, the documentation for FFK should probably note
that the "=note" notation only works if that is an entire line
of layout, and that, e.g., this:
layout = [['=Press to add'], ['addToCart']]
does not work, but this:
layout = ['=Press to add', ['addToCart']]
does.
--
Randall Randall <randall@...>
"[The] poetic justice of cause and effect compels
respect, compassion." -- Faithless, God is a DJ.
|