cancel
Showing results for 
Search instead for 
Did you mean: 

How to read correctly value from drop down list

Former Member
0 Kudos

Hi there ,

I am using drop down by key for populating set of values .

the Display part is working fine . I am able to populate all the desired values in the drop down .

Now suppose when i select the fifth record , and based on this fifth record i have to do a selection on table .

I have a node under which i have a attribute key . The drop dwon UI elemnet is bound to this attribute key .

The following problem i am facing :

To read the record selected on UI , I am using the call " ---> get_attribute ( name = 'key') ."

So suppose the default record was italy and i select america which is fifth record , i get value stored in key as '5'..

and say when i do not make any selection for the record , the default record is italy , the value stored in key is "italy' , i was expecting it as '1'.

Can you please point out the error ? .

Regards,

Abhishek

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

check the domain of the attribute key "value range"

FIX VAL short description

1 italy

2

3

4

5

how is displaying the name in the dropdown?

abhishek_gupta2
Participant
0 Kudos

Hello ,

I am reading the internal table and using set_attribute_value_set().

The display is like :

Italy

India

Russia

China

America

The domain has no fixed values .

Regards,

Abhishek.

Former Member
0 Kudos

I think because you are setting the value to "ITALY" and no change is made to your Attribute then the "KEY" has the value that you set initially.

Once the user select other option that is not the default then is going to your Dropdown Action and is getting the "KEY" value 5, or 2, etc.

Try this: select America, read the value it should be 5, now in the same session select italy now the value should be 1 if the value is 1 then my guess is correct.

If not then try this:

Can you set as default value initial, so you will force the user to always use the dropdown to select a value?

if not then I will do a validation before saving like if key = 'italy' key = '1' but outside your action because the user is not going to your action.

That what's come to my mind right now.

I hope it helps you!

Jason PV

abhishek_gupta2
Participant
0 Kudos

Hello Jason ,

You are correct . But the approch you have suggested will not work in my scenario .

I have to set a default value as it will be stroed in the db .

Hence i tried out a approach . When the dropdown value is selected , it hits the action , there we can set a flag and in our modifyview , we can use this flag and then set the value .

In case the user is ok with the defaut value and does not feels to select the record from the dropdown , then the action is triggered . Hen the flag is set to false and we read the default value and get the key in this case .

Thanks your help !!

regards,

Abhishek