cancel
Showing results for 
Search instead for 
Did you mean: 

How to disable user entries in drop down using CDS annotation/UI annotation

surbhi_bansal
Product and Topic Expert
Product and Topic Expert
1,637

Hi Experts,

I have a CDS view which comes as a drop down (combo box) by use of annotation -

@ObjectModel.resultSet: { sizeCategory: #XS }

However, it can still serve as a field available for user entry , due to which a user can remove the data from drop down. I would like to know how can I prevent user from removing the field value (making the value blank) i.e no other value except values in drop down should be a part of the field .

The application under consideration is a smart template app.

Kindly respond if you have a solution to such issue

Accepted Solutions (0)

Answers (2)

Answers (2)

junwu
SAP Champion
SAP Champion
0 Kudos

why this bothers you?

if user try to put junk data in the filter, they just get no data.....

if it is for edit screen, you just give them error msg when saving....

surbhi_bansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Jun Wu,

Yes, you are correct i can give them an error message while editing also. But, as per our requirement there are certain actions which are dependent on the drop down field value. If it is an invalid value, the actions should not be allowed.

Thanks & Regards

Surbhi Bansal

junwu
SAP Champion
SAP Champion
0 Kudos

if they didn't maintain the value correctly, you will fail them for that action, right?what troubles you?

maheshpalavalli
Active Contributor
0 Kudos

Hi Surbhi Bansal

You can make it as a mandatory field using the annotations or in case of edit, you don't want user to remove the existing value, use the field control and disable that field.

OR am I missing something here?

Thanks,
Mahesh

surbhi_bansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Mahesh Kumar Palavalli

It is a mandatory field. The user can change the value though but, I want the user to be able to select only on eof the values from drop down and not be able to edit the field by typing in.

Is there a way out?

Thank & Regards

Surbhi Bansal

maheshpalavalli
Active Contributor
0 Kudos

Hi Surbhi Bansal,

Fiori element based ui will automatically through error in case if the user enters an incorrect value. i hope you've maintained all the relevant annotations like foreignkey.assocaiton

https://help.sap.com/viewer/cc0c305d2fab47bd808adcad3ca7ee9d/7.5.9/en-US/1b9a9e9d759e4302890c44cf5e1...

Thanks,

Mahesh