On Dec 9, 2006, at 1:01 PM, Sanjay wrote:
>
> Hi All,
>
> I am using a form widget, and have defined a form level custom
> validator to verify two fields combined. In case of error, I want to
> show error message only beside one of these two fields. But the error
> message comes beside every field in the form.
Take a look at the code of FieldsMatch from formencode (for example).
As the validator works on the whole form you need to build an error
dict and place the error in the field's key you want the error to
appear at.
something like:
def validate_python(self, field_dict, state=None):
errors = {}
if there_is_an_error:
errors['foo'] = "Invalid input at foo"
raise Invalid("The form contains an error", field_dict,
state, error_dict=errors)
Alberto
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---