jrief / django-angular

Let AngularJS play well with Django
http://django-angular.awesto.com/
MIT License
1.23k stars 293 forks source link

Class NgFormValidationMixin with add_djng_error attribute set to True #167

Closed juanmitaboada closed 7 years ago

juanmitaboada commented 9 years ago

Hello:

I have been developing for a long time with django-angular and I just found a problem with one specific form.

The problem comes when I POST a form (normal form, NOT Model Form) to the server and the server, Django doesn't validate it, and send it back to the client, then the client get a normal error, and when it start typing in the input, the error message disappears (but the field stays invalid no matter what).

After a lot of debugging I found out that the class NgFormValidationMixin is setting an attribute "add_djng_error" to "True". I also checked out that this attribute is set to "False" on "Model Forms".

This attribute is adding to the resulting HTML code (NOT in Model Forms) an attribute to the field named: djng-error="bound-field"

I also have tested when I set "add_djng_error" to "False" the form is working as expected.

Checking the full source code I see:

Then I went throught "ng-django-form.js" and checked that the directive "djngError" is responsible for turning bound fields from valid to invalid (on pristine) and then back to valid.

The questions are:

Thank you,

jrief commented 9 years ago

Thanks for this detailed bug report. Could you please modify the example code, and create a branch in your fork of the repository, so that I can reproduce it. I currently don't really understand what's happening. Jacob

adrienbrunet commented 7 years ago

My best guess is that it is fixed now. The issue is quite old and a lot have changed.