Using watch, validation message spans aren't added to the register if new fields are added to form
geoffbeaumont opened this issue · comments
The problem is that the root passed to ValidationService.prototype.scanMessages = function (root, remove) is the new element detected, not the form. scanMessages checks for a form and registers the message under the form, but it only walks down the DOM, so if the new element is within the form no form is found and the message is not registered.
In my case I can work round this by adding form attributes to the message spans before adding them to the DOM, but that probably isn't always going to be possible.
Probably need to walk up the DOM until finding a form if the root isn't a form and doesn't contain any forms. Only if that doesn't find a form (in which case the new element detected wasn't relevant) should the function return without searching for message spans to register.
If I'm understanding correctly, this is what #65 is meant to solve. You might try that branch and see if it resolves your issue?
Just need @haacked to
Just published! https://www.npmjs.com/package/aspnet-client-validation/v/0.8.16