Re: [FE-discuss] Overriding user input on errors

Top Page
Author: Ian Bicking
Date:  
To: Mike Orr, Luke Tucker, Anil Makhijani
CC: formencode-discuss
Subject: Re: [FE-discuss] Overriding user input on errors
Mike Orr wrote:
> I have a composite control for attachment management. It has radio
> buttons for keep/replace/delete, and a file upload for "replace". The
> upload must be filled for "replace", and empty for the other two. The
> default is "keep".
>
> So the user chooses "delete" and uploads a file. The chained
> validator rejects it but the "delete" button remains selected. I want
> to override the user input and reselect "keep". I'm using Pylons
> @validate so I have to do it in the validator. I tried updating the
> 'field_dict' arg in .validate_python() but it ignored it. Is there
> another way to do this?


I think this will be hard, because in the case of an error the form is
filled based on the request values, not anything from a validator. That
is, we try to offer up the form in the same state it was submitted.
File controls are an exception, as you can't fill those in.

I think this would have to happen in @validate somehow.

Luke and Anil (copied) had a patch to disable the filling-in of certain
fields in the validate decorator. Maybe that patch would be useful (if
one of you could send it on to Mike).

-- 
Ian Bicking : ianb@??? : http://blog.ianbicking.org

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
FormEncode-discuss mailing list
FormEncode-discuss@???
https://lists.sourceforge.net/lists/listinfo/formencode-discuss