cancel
Showing results for 
Search instead for 
Did you mean: 

Error when using value-help fields with direct input of ID in Fiori Elements V4 App

mark05
Explorer
0 Kudos
1,796

Hello Community,

I've encountered an error when using an input control with value help in a Fiori Elements app (using oData V4 and the template "ui5template.fiorielements.v4.lrop"). The strange thing is, it works before with SAPUI5 version 1.87.9, but after updating it to 1.96.x or 1.97.x the error occurs.

How to recreate the error:

  1. Create a form with input controls with value helps assigned.
  2. Type in a valid ID directly into the input control (without using the value help or the suggestion help)
  3. Leave the input field with focus out (just click outside the control, without using suggestion help)
  4. A dump appears in the console in the following function:


    FieldValueHelpTableWrapperBase-dbg.js:336

  5. The function tries to find the correct item by using id and descr (in version 1.87.x it only searches using the id, here it's working well).

  6. The entered value is not transferred into the oData model afterwards, but still is in the input field. If you're now saving the draft, you have a skew between frontend and backend. This is of course very bad in productive environments, especially if the user does not notice it immediately.

Further information on how we implemented the form:

CAP project with the following entity:

myProperty is a type:

The UI annotations have been extended:

Which results into the following annotations in the metadata:

Thank you very much in advance!

Best regards,

Mark

Accepted Solutions (1)

Accepted Solutions (1)

FabienHenique
Participant
0 Kudos

You should have something like that:

annotate service.MyEntity with { 

myProperty @Common.Text : { 

$value : myProperty.descr, ![@UI.TextArrangement] : #TextFirst }

};

annotate service.myValueList with { 

ID @Common.Text : { 

$value : descr, ![@UI.TextArrangement] : #TextFirst }

};
mark05
Explorer
0 Kudos

Thanks Fabien,

I was able to solve that issue now. The problem was, we had the annotation @cds.odata.valuelist added to each of the entities, which shall be provided as such, but we haven't added the second annotation, you listed above. Now it works smoothly.

Answers (1)

Answers (1)

FabienHenique
Participant
0 Kudos

Hello Mark,

In order to solve this issue, I've added a @Common.Text annotation on the value help itself on top of the main service.

mark05
Explorer
0 Kudos

Hey Fabien,

thanks for your response.

Where do I have to add the annotation? I tried this one:

But the only result was, that the corresponding property only shows "true" instead of the ID in the report.

So unfortunatley, it makes it even worse.

Best regards.