Please help with this error - InfoPath Dev
in

InfoPath Dev

Please help with this error

Last post 03-26-2007 07:25 AM by B.Shiva Prasad. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 03-26-2007 05:59 AM

    • edove
    • Top 500 Contributor
    • Joined on 08-21-2006
    • Posts 50

    Please help with this error

    Hi,

    I'm trying to call the code below from a button on my form and for some reason I keep getting this error:

    "'XDocument.DOM.selectSingleNode(...)' is null or not an object"

    The code:

    function btnCosting::OnClick(eventObj)
    {
    var clicked = XDocument.UI.Confirm("You will not be able to undo this operation. Do you wish to continue?",1);
    if(clicked == 1) {
    XDocument.DOM.selectSingleNode("/my:myFields/my:header/my:costingsComplete").text = 1;
    }
    }

    I can't understand why..
  • 03-26-2007 06:19 AM In reply to

    Re: Please help with this error

    Hi,

    Check once, this Xpath is correct("/my:myFields/my:header/my:costingsComplete"):

    I hope this will help for you.
    K.Ramana Reddy / http://www.ggktech.com
    India.
  • 03-26-2007 06:23 AM In reply to

    • edove
    • Top 500 Contributor
    • Joined on 08-21-2006
    • Posts 50

    Re: Please help with this error

    Well this is what I get if I go to the field under Data Sources and select Copy XPath. The field is in a group called Header under myFields.
  • 03-26-2007 06:43 AM In reply to

    Re: Please help with this error

    Try to delete the first "/" in front of my:myFields.
    You can actually always use an Expression Box to find out the correct xPath. Just put the ExBox to your form, point it to the control/node you want to know the xPath for and then check the "Advanced - edit xPath" check box.
    Listen to Motörhead cos they play Rock'n Roll :)
  • 03-26-2007 06:47 AM In reply to

    Re: Please help with this error

    Hi,

    I think, In Xpath you typed as "header", but in datasource it is "Header".

    Please correct it, then it will work for you.

    I hope this will work for you.
    K.Ramana Reddy / http://www.ggktech.com
    India.
  • 03-26-2007 06:57 AM In reply to

    • edove
    • Top 500 Contributor
    • Joined on 08-21-2006
    • Posts 50

    Re: Please help with this error

    Ok I tried removing the initial "/" - same result.

    According to the exBox the xPath is this "my:header/my:costingsComplete", this didn't work either.

    Also changed "header" to Header but that didn't work. The group "header" is one I created and it doesn't have a capital "H" so it should be as typed.

    Thanks for everyones help so far. I also have the exact same code below trying to do the same thing with a different field. It always prompts but then can't seem to find the field.
  • 03-26-2007 07:02 AM In reply to

    Re: Please help with this error

    Hi,

    I tried with code you have given, it is worked for me, (i.e,i did not get any error).
    K.Ramana Reddy / http://www.ggktech.com
    India.
  • 03-26-2007 07:23 AM In reply to

    • edove
    • Top 500 Contributor
    • Joined on 08-21-2006
    • Posts 50

    Re: Please help with this error

    Still doesn't work for me for some reason!
  • 03-26-2007 07:25 AM In reply to

    Re: Please help with this error

    hi edove,

    put "/" initially and try to write the XPath manually once, with case sensitive. I worked around with your specification and is working for me.
    B.Shiva Prasad
    InfoPath Dev,
    http://www.ggktech.com
    India
Page 1 of 1 (9 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.