Re: get validated single field values?, was: Patch for labelfield "validation"

Reinout van Rees <[email protected]> Sat, 23 Apr 2005 15:25:12 +0200 (CEST)
Newsgroups gmane.comp.web.zope.formulator.devel
Message-ID <Pine.OSX.4.58.0504231515390.29357@reinout-van-rees-computer.local>
On Sat, 23 Apr 2005, Clemens Klein-Robbenhaar wrote:

> I am not sure what the problem is about. "form.validate(request)"
> returns a dictionary of all validated values; the ids of the fields
> are the keys. Alternatively one can use "validate_to_request" and
> the results are stored in the requst therafter. So what problem
> getting the values?

Ah, that way! I was thinking more in object oriented ways. The field
has a value, so I should be asking something of that field. Instead,
the form returns the values of the fields.

I might make sense from an implementation viewpoint, especially if you
want to store the validated results in the REQUEST. That can probably
only be done from the form. From a pythonic viewpoint - to me - it was
a bit unexpected. For display of the fields in a form, you call
field.render_view() or so, but if you want the value you can't do
field.value() but have to ask the form for it. Huh?

> Looking shortly at the code I found a couple of things it should not
> do, like accessing "field_..." parameters in the request ... seems
> to be a real plone product <wink />

I'll keep it in mind for the next time I look at ploneformmailer. At
the moment it does what we need it too. But I expect some more coding
in a few weeks - a good time to make it more well-behaved at the same
time :-)

Reinout

-- 
Reinout van Rees                  r.van.rees-1kr/[email protected]
http://vanrees.org/weblog/            http://zestsoftware.nl
"engineer: a mechanism for converting caffeine into designs"