Dynamically adding items to a list box

  • Thread starter news.microsoft.com
  • Start date
N

news.microsoft.com

Hi,

I have got an InfoPath form with a single list box on it.
I want to populate the list box with Project names from the MS Project
Server web service, but this
web service is not supported by InfoPath (RPC encoding).

Using scripting, I can retrieve an XML document
containing the Project Names I want to add to the list,
but the list box does not display the values. When I
debug my script and inspect the values, I can see that the list box has got
the
correct number of child nodes, and the "text" property
contains all my values.

In my code fragment below, xmlReply is the response from the Project
Server web service, and xmlProjects is a reference to the
list box.

var nodeList = xmlReply.selectNodes
("//ProjectsStatus/Project");

var xmlProjects =
XDocument.DOM.documentElement.selectSingleNode
("my:lstProjects")

for(var i=0; i < nodeList.length; i++)
{
var oNode = nodeList.item(i)
var sProjName = oNode.selectSingleNode
("./ProjectName").text + "\n";

var oChild = XDocument.DOM.createTextNode(
sProjName );

xmlProjects.appendChild( oChild );
}



Does anyone have any ideas on what I'm doing wrong?

Many thanks,

James.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top