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.
>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
TrussworksLeo - 10 Dec 2004 14:53 GMT
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
> >Ok... This maybe a really dumb question but how do I set the default
> >value(s) to a bulleted list?
[quoted text clipped - 13 lines]
> Andrew Watt
> MVP - InfoPath
Andrew Watt [MVP - InfoPath] - 10 Dec 2004 15:39 GMT
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
>Thanks Andrew,
>
[quoted text clipped - 22 lines]
>> Andrew Watt
>> MVP - InfoPath