Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Couldn't able to supply a value to an xml field using local model

Hi ,

     I am trying to dynamically validate my form fields from the model values as shown in the below lines of code.

<Label text="Name1" />

         <Input class="sapUiSmallMarginBottom"

        id="name1" placeholder="Enter Name ..."

        type="Text" liveChange="addressValidation"

        value="{ path : 'mainModel>/Address/Name1',

                     type : 'sap.ui.model.type.String',

                     constraints : { minLength: 3, maxLength: 'metaAddress>/AddressValidation/0/maxLength' }}" 

         valueStateText="Name must not be empty. Maximum 10 characters."/>

here validation is successful if i use the direct numbers for the propertie "minLength : 3". but i want to provide that value form my model.I have tried several ways but unsuccessful. Can any one hlep me out.

Below are the ways i tried.

1. maxLength: 'metaAddress>/AddressValidation/0/maxLength'

2. maxLength: {metaAddress>/AddressValidation/0/maxLength}

3. maxLength: '{metaAddress>/AddressValidation/0/maxLength}'

4. maxLength: "{metaAddress>/AddressValidation/0/maxLength}"

5. maxLength: "metaAddress>/AddressValidation/0/maxLength"

And there is no problem in  getting the values form model.

Former Member
Not what you were looking for? View more on this topic or Ask a question