I think I'm having the same issue.  Did you ever find a solution?

On Feb 14, 5:06 pm, Karen Tracey <kmtra...@gmail.com> wrote:
> On Sat, Feb 14, 2009 at 11:07 AM, Alistair Marshall <
>
> runninga...@googlemail.com> wrote:
>
> > I have been trying to create a custom field that allows the user to
> > enter a flowrate and clean the data back to kg/s or mol/s.
>
> > I though I had everything sorted, when I type '10 tones/year', it
> > correctly did the conversion however when I type something that does
> > not validate such as 'twenty' or '5 mph' the code runs till the raise
> > validation error, however nothing else happens and the overall forms
> > clean function gets called (which doesn't have all the fields in its
> > clean_data attribute.
>
> Nothing else happens as opposed to what?  What are you expecting to
> happen?   One field raising a validation error doe not prevent the overall
> form clear() from being called, this is covered here:
>
> http://docs.djangoproject.com/en/dev/ref/forms/validation/
>
> where it states:
>
> As mentioned, any of these methods can raise a ValidationError. For any
> field, if the Field.clean() method raises a ValidationError, any
> field-specific cleaning method is not called. However, the cleaning methods
> for all remaining fields are still executed.
>
> The clean() method for the Form class or subclass is always run. If that
> method raises a ValidationError, cleaned_data will be an empty dictionary.
>
> The previous paragraph means that if you are overriding Form.clean(), you
> should iterate through self.cleaned_data.items(), possibly considering the
> _errors dictionary attribute on the form as well. In this way, you will
> already know which fields have passed their individual validation
> requirements.
>
> The idea is to get all the problems identified, as far as possible, and not
> let the first error encountered stop the process.  That way (hopefully) all
> the problems can be noted with error messages in one go-round with the user,
> rather than having submit, here's an error, fix one error, resubmit, here's
> a 2nd error, fix, resubmit, here's a 3rd error, etc.
>
> Karen

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