-
Notifications
You must be signed in to change notification settings - Fork 76
Server Side errors are not dismissed after field edit #39
Comments
Thanks, I'll take a look - I think it is because when the server error gets set there is no function to determine if it is valid once the field has been edited. I'll look at adding a property that determines if these errors should be cleared when the ng-model is updated. However, in the mean time you could call ngModelCtrl.removeExternalValidation. https://github.com/jonsamwell/angular-auto-validate/blob/master/src/config/ngModelDecorator.js#L81 Thanks, Jon |
Coluld You help me with removeExternalValidation, I've tried something like:
there is no key name, because it's a server custom message. Unfortunately it doesn't work... Thanks, |
Have you tried just adding a key name when you invoke the setExternalValidatino('server-error',.....); I'll do this enhancement soon as I think it is needed. I'll keep you posted. Let me know if this works as a temp workaround. Thanks for using the module! |
The problem is that when I add 'server-error' then I would need to add a key to the lang, but messages from server are different. I'll wait then for the enhancement, I'm not in a hurry... :) Thanks, |
Thanks for the translation! Right, I'll get on with the enhancement for you this week (just assume it is going to work for now). |
Any luck with this one? Best regards, |
I'm going to tackle this tomorrow - sorry for the delay! |
Hi @emfor sorry for the delay. This issue should no be resolved in the latest release v1.18.4. The external validation errors are removed by default when the control or form is validated. To stop this behavior add the attribute to the parent form.
Let me know how you get on. Jon |
Hi @jonsamwell and @emfor We recently upgraded our application to Angular 1.3.15 and this feature is giving me problems. Previously (Angular 1.2.18), I'd set server-side errors in the form |
I debugged a bit further - it appears that with the default settings (no remove-external-validation-errors-on-submit="false"), this gets called: |
Also, it turns out that it wasn't angular version related, but I had pulled in an update version of angular-auto-validate back in March that looks like it broke this and didn't catch it until now. The newest version shows the same issue. |
I've continued debugging on this. It appears that |
Sorry for the spam. I've figured out the issue. Here it is: In
it looks like we should just delete the entry (if it exists) and it should cover both cases. Since this was an external error to begin with, when we are wiping them out, we don't care that the value exists on ngModelCtrl.$error and is true so we should just delete it. If
If you think this change is reasonable, let me know. I can make a pull request or if you have time, you can make this small change. |
@jonsamwell Have you gotten a chance to see my comments above? |
… on the form controllers autoValidateFormOptions objector by raising the event 'form:{formName}:reset on the controllers scope. The formName is the value in the name attributeon the form tag which also corresponds to the formController.$name property.Fixes issue with removing external validation raised in #39
@abobwhite Sorry for the late reply this should now be fixed in the latest release v1.18.8 |
Hi,
I wanted to test adding server side errors. When I submit the form, fields gets highlighed, but when I edit it. It doesn't remove the validation. Simple example: http://plnkr.co/edit/Ep6XsbyrFDYHkNlhSWBO?p=info
The text was updated successfully, but these errors were encountered: