Skip to content

Improve pf-wizard validation #493

Open
@benjaminapetersen

Description

@benjaminapetersen

Original issue in origin-web-console.

The example in the original issue is this:

var validityWatcher;
// ...
// in a setup fn:
validityWatcher = $scope.$watch("ctrl.selectionForm.$valid", function(isValid) {
     ctrl.steps[0].valid = isValid;
});
// ... 
// in another fn:
      if (validityWatcher) {
        validityWatcher();
        validityWatcher = undefined;
      }
// 
// in a cleanup fn:
    ctrl.$onDestroy = function() {
      if (validityWatcher) {
        validityWatcher();
        validityWatcher = undefined;
      }
// ...

There is a lot of bookkeeping involved for validation & it feels a bit out of sync with typical angular validation. The ideal option is to get it in the view, but a secondary option might be to get a validation function added to the steps & hide the setup/tear down code from the user (hide by adding an ng-form behind the scenes, perhaps w/a name = to the step.id or step.id+rand and then toggling its $valid property based on the validator fn).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions