Input validation not working with OData model

痴心易碎 提交于 2019-12-24 06:33:46

问题


In the current project, I have a SimpleForm on a view. Binding a JSONModel on this view, the validateValue function is working fine on my input field. The constraints on the input field are defined as follows:

<Input
  type="Text"
  maxLength="45"
  value="{
    path: '/carrId',
    type: 'sap.ui.model.type.String',
    constraints: {
      minLength: 1,
      maxLength: 3
    }
  }"
/>

Changing the model to an ODataModel doesn't fire the validateValue and the field is not marked with red if the constraints are not matched.

The view is registered at the message manager.

Do I have to implement the validation by implementing a change event or where is the mistake?


回答1:


Replace sap.ui.model.type.String with the type corresponding to the EDM type of your carrId. E.g. with sap.ui.model.odata.type.String if it has the Type="Edm.String" in metadata.



来源:https://stackoverflow.com/questions/47468688/input-validation-not-working-with-odata-model

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!