Closed simonarangelova closed 1 year ago
Hi @sebastianesch ,
the function
_validateInput
needs to be corrected
Could you please elaborate on why exactly oInput.getBinding("value")
needs to be changed to oInput.getBindingInfo("value")
? The sample seems to be working fine.
Also, ManagedObject#getBindingInfo
is a protected API.
Hi @boghyon,
sorry, I did not notice that getBindingInfo
is protected. When I try the example with getBinding
the return value is undefined
:
getBindingInfo
returns the Binding information defined in the view.
Kind regards, Sebastian
Hi @boghyon,
I debugged the UI5 sample and can confirm that it works. In our case the Binding Info object was missing the binding property and as getBinding
uses return oInfo && oInfo.binding;
, it would not return the binding:
The root cause for the issue was that our binding definition in the view contained path : '{/name}',
instead of path : '/name',
. Removing {} fixed the issue and the example works.
<Input
id="nameInput"
class="sapUiSmallMarginBottom"
placeholder="Enter name"
valueStateText="Name must not be empty. Maximum 10 characters."
value="{
path : '{/name}', <!-- {} breaks binding info -->
type : 'sap.ui.model.type.String',
constraints : {
minLength: 1,
maxLength: 10
}
}"
change= ".onNameChange" />
Sorry for the inconvenience and thanks for the help.
Kind regards, Sebastian
@sebastianesch No prob, thanks for the replies! You might want to subscribe to https://github.com/SAP/ui5-language-assistant/issues/82 and https://github.com/SAP/ui5-language-assistant/issues/563 which, if the requested feature(s) were ever implemented, could detect invalid values such as path: '{/name}'
.
OpenUI5 version: 1.110
Browser/version (+device/version):
Any other tested browsers/devices(OK/FAIL):
URL (minimal example if possible): https://ui5.sap.com/#/entity/sap.m.Input/sample/sap.m.sample.InputChecked
User/password (if required and possible - do not post any confidential information here):
Steps to reproduce the problem: The sample for Input - Checked (https://ui5.sap.com/#/entity/sap.m.Input/sample/sap.m.sample.InputChecked) does not work.
In the Controller code https://ui5.sap.com/#/entity/sap.m.Input/sample/sap.m.sample.InputChecked/code/C.controller.js the function _validateInput needs to be corrected.
What is the expected result?
What happens instead?
Any other information? (attach screenshot if possible) This issue is moved from SAP-docs repository sebastianesch commented (https://github.com/SAP-docs/sapui5/issues/37#issue-1563903050)