[Zope3-Users] Five Formlib and validator

Jesper Petersen instantfoo at gmail.com
Thu Nov 22 19:10:47 EST 2007


Hi Christian,I can see you are using Zope2/Five/Plone so I'm not sure how
well my answer applies, but I'll answer anyway :)
I got a similar form working just fine in Zope3. It could be that you are
using a named template implementation and you forgot to display the
view/error_views

If so, you need to have something like this in the page template to actually
display the error..

        <div class="form-status" tal:condition="view/status">
            <div class="summary" tal:content="view/status">
               Form status summary
            </div>
            <ul class="errors" tal:condition="view/errors">
               <li tal:repeat="error view/error_views">
                  <span tal:replace="structure error">Error Type</span>
               </li>
            </ul>
        </div>


HTH
Jesper


On 11/21/07, Christian Klinger <cklinger at novareto.de> wrote:
>
> Hi,
>
> i try to make a formlib action with an validator.
>
> My environment is
>
> Zope 2.10.4
> Five 1.4.4
> plone.app.form branch 2.5
>
> This is my method:
>
>
>      def validate_change_passwd(self, action, data):
>          errors = self.validate(action, data)
>          # test password
>          from zope.app.form.interfaces import WidgetInputError
>          if not errors:
>              if data['passwort'] != data['confirm']:
>                  errors = WidgetInputError(field_name='passwort',
> widget_title=_(u'Passwort'), errors=_(u'Foo'))
>          return errors
>
>      @form.action(_(u'Speichern'), validator=validate_change_passwd)
>      def action_resutls(self, action, data):
>
>
>
> What do i have to return to display a error message on my form?
>
> I try everything but i don´t get it to work
>
> maybe someone has an tip for me
>
> Christian
>
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope3-users/attachments/20071123/9b85746c/attachment.htm


More information about the Zope3-users mailing list