class ContactForm(forms.Form):
          email = forms.EmailField(required=True,
                             widget=forms.TextInput(attrs=
{'size':'30'}),
                            error_messages={'required':'Please fill
out your Email'})
          ...

in my form html file:
...
label for="id_full_name">Your email address</label>
            {{ form.email.errors }}
            {{ form.email }}<br/>
...

in my view:
def contact(request):
    if request.method == 'POST':
        f = ContactForm(request.POST)
        if f.is_valid():
            email = f.cleaned_data['email']
            ...
            return HttpResponseRedirect(reverse('contact_success'))

When user submit the contact form without fill out email field, the
form get submitted without displaying error message 'Please fill out
your Email'. Instead, I got error: The view app.views.contact didn't
return an HttpResponse object.

it seems f.is_valud return false, which is correct. But I think form
validation should kick in at this point and return error message to
{{ form.email.errors }} field in template. Why doesn't the validation
work? Did I miss anything?
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to