Aljosa Mohorovic wrote: > On Aug 18, 5:13 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> > wrote: >> "2 or more fields" is a signal that the clean() method on the form is >> the right place to do this. At that point, all the fields will have >> individually passed their validation (i.e. they will be of the right >> type) and any fields which didn't pass will not be in self.cleaned_data. > > i can find examples of clean() method and "raise > forms.ValidationError('error msg')" but none on how to bind error with > field. > what i would like to do in clean method is raise field validation > error(after PROBLEM part): > def clean(self): > if custom_validation() == False: > raise forms.ValidationError('custom validation failed') > > # raise validation error for field_1 and field_2 > # PROBLEM: don't know how to raise validation errors on fields > raise forms.ValidationError('field_1 error msg') on field_1 > raise forms.ValidationError('field_2 error msg') on field_2 > > return self.cleaned_data > http://www.djangosnippets.org/snippets/337/
regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---