add first row in repeating section via code - InfoPath Dev
in

InfoPath Dev

add first row in repeating section via code

Last post 08-21-2006 12:19 PM by Agni Jonnalagadda. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 08-17-2006 02:22 PM

    add first row in repeating section via code

    ive been looking on the internet, and so far, all ive found is code that will clone a record. however, i dont want, and i believe cannot use this code.

    This part of the form is for the medical exam. The doctor clicks on the Shoulder Exam button, a new shoulder exam shows. However, if the doctor doesnt click on the shoulder exam button, then there is no shoulder exam record. Up to this point, the only code I have seen involved cloning one of the records in the table. Since, when the doctor presses the button there is no record to clone, the insertBefore and clone functions are useless to me.

    However, I was browsing the microsoft website, and came across the createElement method, which I am hoping could be useful. I've inputed the code into my jscript file (which acts differently than everyone elses, I dont know why). But the code looks like this:

    var dummy = XDocument.DOM.selectSingleNode("dataFields/Demographics/New_Visit/Exam_Shoulder");
    var rowOne = XDocument.DOM.createElement(dummy);

    that gives me a type mismatch error on the 'var rowOne' line.

    I am kind of stuck right now and any help would be appreciated.
  • 08-21-2006 12:19 PM In reply to

    Re: add first row in repeating section via code

    Try this out,
    sampleDataDom = (IXMLDOMDocument2)thisXDocument.CreateDOM();
    sampleDataDom.async = false;
    sampleDataDom.validateOnParse = false;
    sampleDataDom.load("sampledata.xml");
    var dummy = XDocument.DOM.selectSingleNode();
    var rowOne = sampleDataDom.selectSingleNode("dataFields/Demographics/New_Visit/Exam_Shoulder");

    Now clone this node and append to your New_Visit node.

    But your xpath doesnot seem to have prefixes, you need to give one it exists.
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.