Hi,
in some situations after a validation error occurred, I like to give
additional information to the user (hints/explanations why some values are
incorrect)
For example, if a user enters a user name during his registration that is
already in use, I want to display some additional information on how to
recover lost passwords. This additional information should be "rich content",
containing links, images etc.
But not every error in the user name field should trigger that additional
information (e.g. user name is too short/uses banned words). So what I really
want is "what type of error occurred".
This information (type of error) is already encoded in the error message (or
it would be trivial to change the validators that way). But clearly, the
additional information should not go into the basic validation error message
as this should not contain any markup code.
Currently I see the following options:
1. Don't show additional information: ruled out, requirement from customer.
2. Repeat all tests in my view to see what happened: Duplication of efforts,
error-prone, too much logic in the view.
3. Use the error message to decide what information to show: Bad because the
exact error message is locale dependent and may change in the future.
3a. Compare the error message with all error messages in
ValidatorClass.messages to get the key: view has to know which validator
was used for for every field which is error prone and fragile.
Ideally, we would be able to extract the message key from the exception
message and use that to show the additional information. After reading the
code, I think this is not possible currently.
Any other ideas?
fs
So Clearly, this should not go into the
but I would check for a specific error condition in my template/view code.
Currently I don't see a way to accomplish this with the current formencode
besides:
a) If there was an error in the username field, repeat all tests to get the
error co
-------------------------------------------------------------------------
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