Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!
SOLVED

Save the state of an editable listbox

Avatar

Level 2

I created a listbox that has a number of elements in it and then I created "Up" and "Down" arrows to allow the user to move the elements within the listbox to specify the order they want. The problem I have is when I save the document the state of the list box is not preserved. Below is the code I used to save allow the user to move the elements up or down. Please let me know if it is possible to save the state or if I have to find another solution to this requirement.

try

{

if(ListBox1.selectedIndex>0)

{

var selectedItem  = ListBox1.items.nodes.item(ListBox1.selectedIndex)

ListBox1.items.nodes.insert(selectedItem,ListBox1.items.nodes.item(ListBox1.selectedIndex-1))

}

}catch(e)

{

app.alert(e+'');

}

1 Accepted Solution

Avatar

Correct answer by
Level 10

Usually by checking the setting to Automatically for the option "Preserve Scripting changes to form when Saved"  in the Form Properties and Default Tab.

Thanks

Srini

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Usually by checking the setting to Automatically for the option "Preserve Scripting changes to form when Saved"  in the Form Properties and Default Tab.

Thanks

Srini

Avatar

Level 2

Thanks for the help. I didn't even see those options till now.