Skip to content

Custom strategy for validation errors on form load #38

@dkhunt27

Description

@dkhunt27

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions