Thanks, I'll learn that.  :-)

On Aug 26, 4:44 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Tue, 2008-08-26 at 01:39 -0700, est wrote:
> > class ContactForm(forms.Form):
> >     subject = forms.CharField(max_length=100)
> >     message = forms.CharField()
> >     email = forms.EmailField()
> >     phone = forms.CharField(max_length=8)
> >     cc_myself = forms.BooleanField(required=False)
>
> > is there a way that, between 'email' and 'phone', at least one is
> > required? The request contains either 'email' or 'phone', or both, but
> > can not both be none. Is there any way to implement this logic with
> > django newforms?
>
> Set "required=False" for both the email and phone fields. Then write a
> clean() method for the class. This method will be called after all the
> fields have been validated and any fields that pass validation will be
> self.cleaned_data. So you can examine self.cleaned_data.keys() to see
> what is present and act on that information.
>
> See the forms documentation about cleaning for how clean() works, but
> basically you have to return the cleaned_data dictionary at the end of
> it.
>
> Regards,
> Malcolm
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to