Re: htmlfill, errors and examples

Ian Bicking <[email protected]>
Newsgroups gmane.comp.python.formencode
Message-ID <[email protected]>
michelts wrote:
> Hi guys,
> 
> I use formencode to validate my forms, I do the form presentation by
> hand (I don't use any form generator), in my page I insert some tags
> to be replaced by the error message (<form:error name="field">).
> 
> I had an idea, I want to be able to replace the tag by an example when
> there is not error (the first time the form is loaded). Look:
> 
>     # the raw code
>     Date: <input type="text" name="date"> <form:error name="date">
> 
>     # the first time the form is loaded
>     Date: _____________ (ex: 2006/09/20)
> 
>     # if there was an error
>     Date: 2006/02/31 the data is not valid

Hmm... right now there is <form:iferror>, but it almost seems like you 
want <form:ifnoterror> or something along those lines.  E.g.:

   Date: <input type="text" name="date"> <form:error name="date">
   <form:iferror name="not date">ex: 2006/09/20</form:if-error>

I've added the "not field_name" form to the FormEncode trunk.  Will this 
work for you?



-- 
Ian Bicking | [email protected] | http://blog.ianbicking.org

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.