Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3363

Trigger DataBinding Validation for controls

$
0
0

Hello Experts,

I've a TextField in my SAPUI5 application with some constraints:

<sap.ui.commons:TextField     validationError="validatePriceError"    parseError="validatePriceError"    formatError="validatePriceError"    validationSuccess="validatePriceSuccess"        value="{        path: 'oTblReqLinesModel>price',        type : 'sap.ui.model.type.Float',        formatOptions : {            maxFractionDigits: 2,            minFractionDigits: 2,            decimalSeparator: '.'        },            constraints : {        minimum: 0.01    }    
}"></sap.ui.commons:TextField>

I'm using a validation function and it works:

validatePriceError : function(oEvent) {    var oCtrl = oEvent.getParameter("element");        var sValueState = "someError...";            var oRttTextField = new sap.ui.commons.RichTooltip({        valueStateText : sValueState    });    oCtrl.setValueState(sap.ui.core.ValueState.Error);    oCtrl.setTooltip(oRttTextField);            var oView = sap.ui.getCore().byId("app");    var oController = oView.getController();    oController.setTotal();
}

I also have a "Check Form" button.   

How can I trigger the 'validatePriceError' function? (without writing the constraints logic again or add more functions)

Regards,

Omri


Viewing all articles
Browse latest Browse all 3363

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>