AU2 Multiple validation controllers

UPDATE: I may have figured it out but can’t test thoroughly right now.

Working through my form builder migration and I hit a spot that is stumping me. I have a control that I call a List Builder, and it utilizes a collection/list control to hold an array of custom objects. The object structure is defined by a 3rd party. A custom form can be designed using the same form layout components as the form builder with a few exceptions such as not allowing a nested list builder. I’m sure I am doing something stupid here.

The issue I’m running into is with the 2 validation controllers. There is a primary validation controller that resides on the class that handles the form and it is setup like this. This is my “global” validator

private validationController: IValidationController = resolve(newInstanceForScope(IValidationController));

When list builder control is instantiating, a new validator controller is needed only for this form control and is instantiated like this. I keep a named collection so that I can easily look them up by the form control Id.

 validationController = {
                    name: validatorName,
                    validationController: this.container.get(newInstanceOf(IValidationController)) as any 
                };

The form looks like this rendered, ignore the layout, this is early in my migration so I was just trying to get adding/removing items working.


When Clicking ‘Add’ the validation controller gets called

   let controller = this.controlFactory.getValidationController(this.id);
        const result = await controller.validate();

During debug inspection, I can see the objects on that controller are the 5 form elements defined for that form

The one I instantiate as global only has the listbuilder control as it should.

When I actually call validate, it is validating both controllers. item 6 and 7 are defined on the global controller.