问题
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 with the type corresponding to the EDM type of your sap.ui.model.type.String
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