[Zope] Problems with Formulator

Eric Merritt cyberlync at yahoo.com
Thu Oct 2 15:57:04 EDT 2003


I am a relative zope newbie, and I am tring to use
Formulator to render and validate a input form. For
the most part everything works well, I do however have
two problems. The first problem is that the
form.header() and form.footer() pieces that are shown
in most documentation cause and attribute error. There
is an easy work around, you just put the <form> tags
in yourself. It does, however, lead me to think that I
am missing something somewhere becuase all the docs
use this notation.

The second piece is a bit more problematic. Following
a bit of instruction by the zope labs folks I created
the below script(python). When I try to call it in the
application I get an authorization error. This
generally makes sense considering the constraints zope
puts on scripts, but it does make using a generic
validator a bit more difficult. Does have any
suggestions for a workaround?

Thanks for the input,
Eric




from Products.Formulator.Form import
FormValidationError

req = context.REQUEST
error = ''
try:
  container.signup_form.validate_all_to_request(req)
except FormValidationError, e:
  for i in e.errors:
   title = i.field.get_value('title')
   text = i.error_text
   error = error + '<b>' + title + '</b>' + text +
'<p>'
   error_html =  "<b>The following errors were found
in the form:</b>\
         <p>\
        <blockquote style=\"color: red; font-size:
13px\">" + error +  "</blockquote></p>"
  return error_html
else:
  return container.yourScriptOrMethod()

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com



More information about the Zope mailing list