Need help with JS code and an access database as main source - InfoPath Dev
in

InfoPath Dev

Need help with JS code and an access database as main source

Last post 02-17-2009 03:24 PM by nucel. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 02-17-2009 02:35 PM

    • nucel
    • Not Ranked
    • Joined on 01-28-2009
    • Posts 6

    Need help with JS code and an access database as main source

    I am trying to write a calculation that adds three years from a date of birth entry and then puts the result date in a different field.  While I have done this with Infopath itself, I cannot seem to figure out how to select the proper node in my access datasource to put the result.  Please see data structure and code below:

     1 by you.

    function msoxd__tblChild_ChildDOB_attr::OnAfterChange(eventObj)

     {

     // Write code here to restore the global state. if (eventObj.IsUndoRedo)

     {

     // An undo or redo operation has occurred and the DOM is read-only. return; }

     // A field change has occurred and the DOM is writable. Write code here to respond to the changes.

    var tay=new Date()

    var tdy=GetDateString(tay)

    var dateObj = new Date(eventObj.Site.text.replace(/(\d\d\d\d)-(\d\d)-(\d\d)/, "$2-$3-$1"));

    // var dt = dateObj.getDate(); var dt=GetDateString(dateObj)

    //var dt= XDocument.DOM.selectSingleNode("my:IFSP/my:DOB").text var res =datediff1(dt,tdy,'m')

    //XDocument.UI.Alert('today '+res);

    var dateObj = new

    Date(eventObj.Site.text.replace(/(\d\d\d\d)-(\d\d)-(\d\d)/, "$2-$3-$1"))

    var dateYear = dateObj.getYear()

    dateObj.setYear(dateYear + 3)

    XDocument.DOM.selectSingleNode("my:myFields/my:dataFields/my:tblChild/my:ChildThirdBirthday").text = GetDateString(dateObj)

     }

     }

    The part in BOLD is what I cannot figure out.  Thanks!

  • 02-17-2009 03:24 PM In reply to

    • nucel
    • Not Ranked
    • Joined on 01-28-2009
    • Posts 6

    Re: Need help with JS code and an access database as main source

    I figured it out, thank you all again to those who help us out here.
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.