Re: List of all errors encountered in a form

Ian Bicking <[email protected]> Wed, 4 Feb 2009 17:43:00 -0600
Newsgroups gmane.comp.python.formencode
Message-ID <[email protected]>
On Wed, Feb 4, 2009 at 4:13 PM, [email protected] <[email protected]> wrote:

> Hi,
>
> Is there an easy way to access any errors which may have been flagged in a
> schema in a final chained validator? I want to insert a generic message at
> the top of the page letting the user know that the form has errors.
> I was approaching this through a custom chained_validator but I'm unsure of
> what value to test against to see if any errors have allready occoured,
> error_dict dosen't seem to exist. This is in pylons using @validate
> decorator.
>

Chained validators don't have access to previous errors.  The actual
validation produces an exception that contains all the errors.  @validate
then runs those through htmlfill.  I'm not sure if there's a way to get into
@validate; you might want to ask on the Pylons list.


> An alternative [hacky ]fix to my problem and also something I'm having no
> luck with would be to be able to anchor to the top of the form when the
> page is reloaded, but I've no idea how to achieve it.
>

I'm not sure what you mean?  Oh, like redirect to #top?  You could change to
<form action="page#top">; for successful submissions that shouldn't do
anything, but for unsuccessful submissions you'd go to the top.


-- 
Ian Bicking  |  http://blog.ianbicking.org

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com

_______________________________________________
FormEncode-discuss mailing list
FormEncode-discuss-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/formencode-discuss