Hi,

I am currently set up a ajax form (code below)
But I don't manage the error return.

I would like a result like, but in Ajax :
http://www.turbogears.org/2.0/docs/_images/movie_form_6.png

Please, help me..

class CommentFields(WidgetsList):
    """The WidgetsList defines the fields of the form."""

    name = TextField(validator=validators.NotEmpty())
    email = TextField(validator=validators.Email(not_empty=True),
                    attrs={'size':30})
    comment = TextArea(validator=validators.NotEmpty())
    notify = CheckBox(label="Notify me")

ajax_form = AjaxForm(id="ajax_form",
                   fields=CommentFields(),
                   target="output",
                   action="do_search")

class TestFormController(BaseController):
    """
    The project controller for the pimseotools application.
    """
    @expose('pimseotools.templates.testform')
    def entry(self, **kw):
        pylons.c.form=ajax_form
        return dict(value=kw)

    @expose()
    def api_validation_error(self, **kw):
        kw['errors'] = pylons.c.form_errors

        return dict(kw['errors'])

    @expose()
    @validate(ajax_form, error_handler=api_validation_error)
    def do_search(self, **kw):
        return "<p>Recieved Data:<br/>%(name)s<br/>%(email)s<br/>%
(comment)s<br/>%(notify)s<br/></p>" % kw

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to