On Nov 28, 2007 10:12 AM, Ryan K <[EMAIL PROTECTED]> wrote:
> I have a basic registration form for my site that has fields for a
> postal code, state and a country. Since our site caters to
> international users, I only want to require a state and postal code
> only if the country is the United States. I have a clean_country
> method in my form that raises a ValidationError if postal_code and
> state are empty strings but the error message displays next to the
> country field. How can I make the errors appear next to the proper
> field even though another field's clean method is propagating the
> ValidationError? I don't want to use clean() because the errors should
> clearly be marked and not something generic at the top.

Rather than using clean_country, use clean_postal_code and
clean_state, and have each of them check if the country is United
States. ultimately, you're validating those fields, not country, so
those are the ones you should be cleaning.

-Gul

--~--~---------~--~----~------------~-------~--~----~
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