Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Drop Down List Populating a List Box

Avatar

Level 4

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

Level 10

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

Level 4

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

Level 10

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

Level 4

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