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.

Drop Down List Populating a List Box

Avatar

Former Community Member

I have a drop-down list that is being populated by a web service.  What I need to do is when a user clicks on a choice in the drop-down it is moved to the list box.

I have the following in a change event of the drop-down list:

lbCompanyCode.addItem(xfa.event.newText);

It works like it should but when I submit the form in LiveCycle the data disappears from the list box.

Any thoughts? 

Thank you in advance!

John

5 Replies

Avatar

Former Community Member

John,

You have happened upon an issue with the ListBox event model. A ListBox has two commit options, select and exit. When you populate the ListBox upon the DropDown change event, you are bypassing both commit options so the ListBox value(s) is not injected into the data model.

Here's what I did to circumvent:

1) on my drop-down change event I added JavaScript to execute my listbox exit event

     form1.page1.subform1.listBox.execEvent("exit");

2) on my listbox exit event I added JavaScript to populate the listbox with the drop-down value, iterate over the listbox items for the number of items in the list, and then use 'setItemState' to mimic selection (NOTE, allow multiple selections is enabled on the listbox)

     form1.page1.subform1.listBox.addItem(xfa.event.newText);
     var listBoxCnt = form1.page1.subform1.listBox.length;
     for (i=0; i < listBoxCnt; i++) {
         form1.page1.subform1.listBox.setItemState(i,true);
     }

My sample is attached.

Steve

Avatar

Former Community Member

Steve,

I followed what you attached and your example worked fine.  I don't kno why I can't get mine to work.  It seems like the data is not staying in the XML when I click complete in LiveCycle.  I used the record and playback and the data is not getting carried into the XML file when the form moves to another step.

Any thoughts?

Thanks,

John

Avatar

Former Community Member

John,

Sorry, I did not realize that the problem was related to process management. I thought it was submission from Reader/Acrobat to a server.

Is the initial PDF rendered in Workspace?

Is the Form Data Mappings > Input Form Variabe set to the document root in the Assign Task?

Steve

Avatar

Former Community Member

Steve,

I have it set up correctly and my other data flows over fine, just not the list box. I don't know if its an XML issue or not. I have everything bound correctly.

Thanks,

John Daily

John Daily

Application Systems Analyst III

King Pharmaceuticals, Inc.

Office: 423-989-7165

Cell: 423-956-3911

Avatar

Former Community Member

@Steve

I had this problem in my form... the solution worked.