Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom strategy for validation errors on form load #38

Open
dkhunt27 opened this issue Apr 30, 2015 · 0 comments
Open

Custom strategy for validation errors on form load #38

dkhunt27 opened this issue Apr 30, 2015 · 0 comments

Comments

@dkhunt27
Copy link
Contributor

I am having issues with a custom strategy which i want to show any validation errors whenever the page is loaded. The page loads an async data source to populate the fields. I am assuming I need to wait for that data source to load and then return the validation results...but not sure how to wire that in. We are using $rootScope.$broadcast(); to send an event when the data is loaded...but not sure if that can be accessed via the config. I don't really see a form.$loaded event to look at either.

myapp.config(function (xtFormConfigProvider) {
xtFormConfigProvider.addValidationStrategy('customStrategy', function (form, ngModel) {
return ngModel.$invalid;
});
});

With the strategy as is, the tooltips work sometimes, but sometimes they load unexpectedly. Sometimes, if there is an error initially, the tooltip will appear in the upper left corner. Other times, tooltips will appear initially on the proper element, but a valid element might have its tooltip visible too.

Also, if there are tooltips visible and you change tabs...those tooltips stay visible and there is no way to hide them. (This might be another issue)

I am using focus-error= true and that custom stragety.

Using angular ui and jade if that matters.

Thanks,
Dan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant