I have a form and trying to do validation. When I submit a form without any values into the field, "reason", I get this error.
Exception Type: KeyError Exception Value: 'reason' at this line of ReasonForm: if(self.cleaned_data['reason']==''): here is my ReasonForm: class ReasonForm(forms.Form): reason = forms.CharField(max_length=250) def clean(self): if(self.cleaned_data['reason']==''): raise forms.ValidationError('Invalid Reason, please enter it.') return self.cleaned_data In my view: if request.method == 'POST': form = forms.ReasonForm(request.POST) if form.is_valid(): do stuff here --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---