Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Get ComboBox ValueText from Value

Avatar

Level 2

Hi, i have a ComboBox with this parameters:

Value     Text

A            AAAA

B            BBBB

C            CCCC

D            DDDD

I need a method that returns "AAAA" to input "A" .

I have found two similar method "getDisplayItem" and "getSaveItem", but they use numbers to identify position of item (Es 0,1,2 etc...).

Otherwise the method "boundItem" the input "AAAA" returns me "A". I  must use the opposite.

Anyone can help me?

Kind Rergard

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Federico, to be able to return the value chosen of a DropDownList you may use its property rawValue or get his value...

You can use one of the following: //This will return the values A, B, C or D

comboBox.rawValue;

comboBox.value.text.value;

to get the value which is displayed you must use the method getDisplayItem()

You can use this method with the following syntax:

comboBox.getDisplayItem(comboBox.selectedIndex);

View solution in original post

4 Replies

Avatar

Correct answer by
Level 10

Hi Federico, to be able to return the value chosen of a DropDownList you may use its property rawValue or get his value...

You can use one of the following: //This will return the values A, B, C or D

comboBox.rawValue;

comboBox.value.text.value;

to get the value which is displayed you must use the method getDisplayItem()

You can use this method with the following syntax:

comboBox.getDisplayItem(comboBox.selectedIndex);

Avatar

Level 2

Hi Magus, thanks for reply.

The way that you show me, allow me to get the text-value displayed at combobox.

Otherwise I need a method that will take as input a value, check if it's associated with a predetermined combobox, and return  its combobox text-value.

Does it esixt in livecycle or is necessary to build it?


Kind Regards.

Avatar

Level 10

Well initially, if this is what you are talking about, when you type a character in the combobox it should automatically have the first item that corresponds to that character typed in displayed as selected item.

So if you have AAAA, BBBB, CCCC, DDDD as options in the combobox and you type in 'a' you should have AAAA displayed in the combobox. If typed in 'b', well BBBB should be displayed.

Avatar

Level 2

Thanks Magus, now I understand how to do.

Kind Regard.