Re: [FE-discuss] Making not_empty depend on other fields

Top Page
Author: Ian Bicking
Date:  
To: Paul Johnston
CC: formencode-discuss
Subject: Re: [FE-discuss] Making not_empty depend on other fields
Paul Johnston wrote:
> Hi,
>
> I have a form, on which some fields may be optional or compulsory,
> depending on the value of a different field. I'm using FormEncode,
> ToscaWidgets and TurboGears. I have a hacky solution, looking for a
> neater one.
>
> I realise I could use a compound validator, but this won't give me the
> error reporting I want. I'd like the "please enter a value" message to
> appear next to the fields. Using a compound validator would put a
> message like "department: please enter a value" at the bottom of the form.


Did you try using formencode.validators.RequireIfMissing? That should
work, like chained_validators=RequireIfMissing(require='field1'
missing='field2')

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

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
FormEncode-discuss mailing list
FormEncode-discuss@???
https://lists.sourceforge.net/lists/listinfo/formencode-discuss