Example using jScript - Repeating group is called 'rGroup'
=========================================
On the 'After Validate' event of a 'check box' field named 'fCheck' contained in rGroup with a checked value of 1 and unchecked value of -1
if(eventObj.Source.selectSingleNode(".").text =='1')
{
var nodeParent = eventObj.Source.selectSingleNode("../..");
var nodeNextSibling = eventObj.Source.selectSingleNode("..").nextSibling;
//Get a reference to the sampledata DOM.
var objSampleDataDOM = XDocument.DOM;
//Create a new DOMDocument, and load the template into it.
var objTemplateDoc = XDocument.CreateDOM();
objTemplateDoc.validateOnParse = false;
objTemplateDoc.load("template.xml");
//Set the SelectionNamespaces to the same value as the main DOM.
var strSelectionNamespaces = objSampleDataDOM.getProperty("SelectionNamespaces");
objTemplateDoc.setProperty("SelectionNamespaces", strSelectionNamespaces );
//Clone the repeating group from the 'template' DOM
var nodeClone = objTemplateDoc.selectSingleNode("//my:rGroup").cloneNode(true);
//Insert the new node (if nodeNextSibling is null then it will append)
var nodeNew = nodeParent.insertBefore(nodeClone,nodeNextSibling);
}
You probably want to reset the checkbox after the insert occurs?
Just add eventObj.Source.selectSingleNode(".").text = '-1' to the code.