Bulleted Lists

T

TrussworksLeo

Ok... This maybe a really dumb question but how do I set the default
value(s) to a bulleted list?
This is a list right? Why is there only one value? Shouldnt it be more like
a drop down where you add multiple values? I have a bunch of items I would
like to add to a bulleted list and hve the use be able to delete them if
needed.
 
A

Andrew Watt [MVP - InfoPath]

Ok... This maybe a really dumb question but how do I set the default
value(s) to a bulleted list?
This is a list right? Why is there only one value? Shouldnt it be more like
a drop down where you add multiple values? I have a bunch of items I would
like to add to a bulleted list and hve the use be able to delete them if
needed.

Leo,

A list is primarily intended for an end user to enter values, rather
you prepopulating the list.

You can, however, populate the list by code in the OnLoad event to
manipulate the DOM, add nodes and assign values to those nodes.

Andrew Watt
MVP - InfoPath
 
T

TrussworksLeo

Thanks Andrew,

You wouldn't by chance have an example piece of VB.Net code I could look at
would you?

I am using Managed Code in VB.Net.

Thanks, Leo
 
A

Andrew Watt [MVP - InfoPath]

When I played with it this morning this is the JScript code, I
created.

function XDocument::OnLoad(eventObj)
{
var myNode =
XDocument.DOM.selectSingleNode("/my:myFields/my:group1/my:field1[1]");
myNode.text = "Hello";
var myNS =
"http://schemas.microsoft.com/office/infopath/2003/myXSD/2004-12-10T09:26:54"
var newNode = XDocument.DOM.createNode(1, "my:field1", myNS);
newNode.text = "World";
var myGroup =
XDocument.DOM.selectSingleNode("/my:myFields/my:group1");
myGroup.appendChild(newNode);
var newNode2 = XDocument.DOM.createNode(1, "my:field1", myNS);
newNode2.text = "Beating";
myGroup.appendChild(newNode2);
var newNode3 = XDocument.DOM.createNode(1, "my:field1", myNS);
newNode3.text = "InfoPath";
myGroup.appendChild(newNode3);
}

I am sure it can be written more elegantly.

Andrew Watt
MVP - InfoPath
 

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