Repeating sections

P

PeterJB

Hi

Is there a way of adding a button to a form to insert a section into a
repeating form? I want a nice user friendly way of adding new sections to
the top only.

Also can i remove cut, copy and paste from the shortcut menu of a repeating
section?

Pete
 
F

Franck Dauché

Hi Peter,

You ca do this by code using behind your button:
IXMLDOMDocument2 templateDom = (IXMLDOMDocument2)thisXDocument.CreateDOM();
templateDom.validateOnParse = false;
templateDom.load("template.xml");
templateDom.setProperty("SelectionNamespaces",
"xmlns:my='http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-10-10T17-59-19'");
IXMLDOMNode oTemplateGrp =
templateDom.selectSingleNode("/my:myFields/my:group1/my:group2");
IXMLDOMNode oTemplateNode = oTemplateGrp.cloneNode(true);
IXMLDOMNode oGroup1 =
thisXDocument.DOM.selectSingleNode("/my:myFields/my:group1");
oGroup1.appendChild(oTemplateNode);

You can also move items up and down your table (I think that it is what you
are after):
http://blogs.msdn.com/infopath/archive/2005/02/23/378968.aspx

Hope that it helps.

Regards,

Franck Dauché
 
P

PeterJB

Thanks Franck

I am actually trying to prevent users from doing anything except add an item
to the top of the repeating section (sort of like a stack of sections).

Can I get rid of the copy/paste/cut in the shortcut menu?

Pete
 
F

Franck Dauché

Hi Peter,

Why don't you just uncheck: "Allow users to insert and delete rows" and
manage row additions with your custom button?

Franck
 
Top