Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / December 2005

Tip: Looking for answers? Try searching our database.

Validation script for checkbox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sripri96 - 28 Dec 2005 22:33 GMT
Hi:

I have a repeating table that has several columns and one of them is a
checkbox. I want to perform the following task: Once the checkbox is
"checked", it should copy the entire row and paste it in another table. Can
this be done? I am new to InfoPath, so any tip on this would be great!!

Thanks,
sripri96
Franck Dauché - 29 Dec 2005 05:40 GMT
Hi,

You need to catch the OnAfterChange event.  If you have 3 fields in group2,
and that your checkbox is linked to field1:

[InfoPathEventHandler(MatchPath="/my:myFields/my:group1/my:group2/my:field1", EventType=InfoPathEventType.OnAfterChange)]
public void field1_OnAfterChange(DataDOMEvent e)
{
 if (e.IsUndoRedo) {return;}
 test(e);
}
private void test(DataDOMEvent e)
{
 IXMLDOMNode oNode = e.Site.selectSingleNode("..");
 IXMLDOMNode oField2 = oNode.selectSingleNode("my:field2");
 IXMLDOMNode oField3 = oNode.selectSingleNode("my:field3");
 //you can assign oField2.text and oField3.text to other nodes or use
appendChild (see below) in another repeating section....
}

To appendChild use something like:
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);

Hope that it helps.

Regards,

Franck Dauché

> Hi:
>
[quoted text clipped - 5 lines]
> Thanks,
> sripri96
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.