I am trying to do validation on two input fields on a simpleform in a custom Fiori application. I am trying to replicate the functionality available in the UI5 Explorer App:
https://sapui5.hana.ondemand.com/explored.html#/sample/sap.m.sample.InputChecked/preview
The problem I am having is that the attachValidationError and attachValidationSuccess events are not firing when the user changes focus from the input fields. The initial validation works (the user leaves the input field empty (or removes the existing value) and then tries to save their changes and they receive an alert that they must enter a value. However when I enter a value and then move focus away from the input field, the validation does not get performed and the status remains Error. It seems like the event is not bubbling up to the core, but I'm not sure what would be preventing that.
My code looks the same as in the above referenced sample. The only differences that I can see between my code and the example are the following:
- The example view comes from the sap.ui.core.mvc namespace, whereas mine comes from the sap.ui.core namespace.
- I am using an XMLView fragment for my form
I've attached the XML fragment file and the controller (renamed with a .txt extension) in case someone wants to look at the code.
The input fields with validation are cName and rDoc.
In the controller file you will see the attachValidation events defined in the onInit function and at the bottom of the file is the ValidateHeaderData function (which is working).
Thanks in advance for any help you can provide.
Regards,
Dave