Get errors for view from MessageManger

Viewed 68

I'm trying to switch from manual validation to using the Message Manager.

I registered the view in the manager

oMessageManager.registerObject(this.getView(), true);

I added constraints to my controls

<Input                                               
    value="{
        path: 'viewModel>Value',
        type:'sap.ui.model.odata.type.Decimal', 
        formatOptions: {minFractionDigits:0, maxFractionDigits:2, decimalSeparator:',', groupingSeparator: ''},
        constraints: {precision: 13, scale: 2}
    }"
    description="{parts: [{path : 'viewModel>Currency'}, {path: 'viewModel>Unit'}], formatter: '.formatter.formatMeasure' }"
    fieldGroupIds="required-value"
    textAlign="Right"                                                    >
</Input>

and yes it works, the control gets is state update if constraints are violated.

But now if the user were to click the submit button, is there a good way to check if the current view contains errors?

ATM I'm using the fieldGroupsIds, loop over them to get the errorStateValue for each control and check if it is None. But I suppose there must be a better way.

0 Answers
Related