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

pre-selection of a listbox item after clicking a button

Avatar

Level 2

Hello,

I have a listbox with a lot of item to choose. Now I have to implement a button that the listbox will scroll down to a particular item of the listbox.

E.g. click on button1 -> the listbox scrolls automatically to item no. 20 (and select it)

click on button 2 -> the listbox scroll automatically to item no. 30 (and selcect it)

Does anyone have an idea?

Thanks.

Regards,

ra_be

1 Accepted Solution

Avatar

Correct answer by
Level 7

Hi ra_be,

Here's a simplified sample that should help you.

View solution in original post

5 Replies

Avatar

Correct answer by
Level 7

Hi ra_be,

Here's a simplified sample that should help you.

Avatar

Level 2

Thanks. Actually it is too easy...

Avatar

Level 10

So how does that work accessing the specified value without using "boundItem."

I've just been playing around with something similar and couldn't get it to work with just using rawValue (I've got a couple of recent threads about it on here).

Avatar

Level 2

The code is "Listbox.rawValue = 1;" or "Listbox.rawValue = 27;".

But you have to define the "element values" before. Click on your listbox, then object, then connection. Just tick the "Define elements value" and the code should work. (I am not quite sure with names and captions as I am not using an English version of LSD.)

Avatar

Level 7

Using the boundItem method is probably a better way of doing it for the examples you posted Jono, especially for the switch statement. ra_be's sounded like a simple one-off. ra_be, good catch on calling out that you have to specify the item values, I didn't think to mention that.