Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

ListBox Select All

Avatar

Level 3

How do I select all items in a list box.

The box is being populated by other buttons. Then when i save the form and collect responses it only takes the item that is selected. So I need to have ALL selected by defualt.

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

I am assuming that when you select the items in the ListBox by hand they are showing up onn the data file right?

Here is an example that shows how I did it....unless I am misunderstanding what it is you are looking for.

Paul

View solution in original post

13 Replies

Avatar

Former Community Member

Did you configure the listbox to be a multi-select listbox?

Paul

Avatar

Level 3

Yes. I did. I can get it to work if I manual click and shift click the list, but I want it done automatically. Is there a way to have a button perform the select all? I have a button that adds items from several drop down menus to the box, I could just add it on the end of that one.

Benjamin  Speich

Mobile: 312-504-8820

1-877-MENTICE

Avatar

Level 3

Yes. I did. I can get it to work if I manual click and shift click the list, but I want it done automatically. Is there a way to have a button perform the select all? I have a button that adds items from several drop down menus to the box, I could just add it on the end of that one.

Avatar

Former Community Member

You woudl have to pass all of the values you want to set in a single call. For example:

ListBox1.rawValue = "One\nTwo\nThree";

The \n is a newline designation in Javascript and is used as the selection separator.

Paul

Avatar

Level 3

Can you specify what "one" "two" three" are? Would they be specific to my form?

Avatar

Level 3

Well i played with it a little more. Maybe i am not explaining correctly.

My listbox is already being populated by other events. The user never has to actually select anything in the listbox. When i get the form back and export the data to a CSV file nothing from the listbox is being copied because nothing is selected. So i have to reopen the file select all and then save and then export again. But i have like 50-100 of these forms. So is there a way that when the user adds things to this box they are automaticallly selected? As if someone went in and manually selected them all? Or do i just have to live with selecting them manually?

Avatar

Correct answer by
Former Community Member

I am assuming that when you select the items in the ListBox by hand they are showing up onn the data file right?

Here is an example that shows how I did it....unless I am misunderstanding what it is you are looking for.

Paul

Avatar

Level 3

Perfect. The select all loop is what was looking for. I just wanted them to all be selected by default (almost). So this works. Now if it is wrong its because the user did something stupid. HAHAHAHA

And yes they all show up now when I run the report.

Avatar

Level 2

Hi Paul,

I have the same problem.

Could I have a look at the pdf please?

Thanks,

Larissa

Avatar

Level 10

Hi Larissa,

Paul's sample is in the post just above yours, here: Re: ListBox Select All.

If you right-click on it you can download and then open in LC Designer from your computer.

Niall

Avatar

Level 2

Hi Niall,

I tried to have a look at it but keep getting an error message.

Forbidden

You don't have permission to access /servlet/JiveServlet/download/2462689-31193/ListBox_Programmatic.pdf on this server.

I am surprised that you can open it.

Cheers,

Larissa

Avatar

Level 10

Hi Larissa,

Hadn't tried, but managed to download file.

I have loaded it up onto Acrobat.com, but it is Paul's solutions ;-)

Here it is: https://acrobat.com/#d=GG6uiQm5GR7LbadqxwCE5w

Niall

Avatar

Level 3

Hey guys,

i am trying to apply this example into my form, but it doesnt work for some reason.

the example works fine when I open it in my LCD, but even when I open a new page and place it there, it doesnt work.

Do you have any idea what the reason could be??

Thanks you!

Diana

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----