SAPUI5有标准的例子说明,
Input checks are handled via the validation of the data binding. In this example there are two inputs that are validated (a) while the user types and (b) when the user continues the process. If the built-in validation types are not sufficient you can create your own, like the email type in this example.
,所以就看了一下他代码就把他功能代码COPY到自己的运用中来了,结果发现在自己的程序中总是没效果,输入值后不会提示,然后输入框失去焦点后,输入框里的值就被清空了,而我把此XML,JS拷到WEB IED的一个运用中运行又是正常的,这就难了,就这样COPY代码,折腾了一下午一行行的对代码,最后才发现,我在引用此XML的HTML中定义时少一句:
data-sap-ui-xx-bindingSyntax="complex",加上这句后就正常了。
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>
<script src="./resources/sap-ui-core.js"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.m"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-xx-bindingSyntax="complex"
data-sap-ui-resourceroots='{"sap.alipay.wt": "./"}'>
</script>
<!-- only load the mobile lib "sap.m" and the "sap_bluecrystal" theme -->
<script>
var app = new sap.m.App({initialPage:"idalipay1"});
var page = sap.ui.view({id:"idalipay1", viewName:"sap.alipay.wt.view.BuyRegisterSAP", type:sap.ui.core.mvc.ViewType.XML});
app.addPage(page);
app.placeAt("content");
</script>
.....................................