Error Message: Undeclared Namespace - InfoPath Dev
in

InfoPath Dev

Error Message: Undeclared Namespace

Last post 10-07-2008 07:35 AM by dlgross. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 10-03-2008 10:33 AM

    Error Message: Undeclared Namespace

    I have the following code and I get an Reference to Undeclared Namespace prefix: 'my' error. I have looked through this forum and can not figure out my mistake. Could someone please tell me what I am doing wrong?

    function CTRL102_5::OnClick(eventObj)
    {
     // Write your code here
     var jobNumber = XDocument.DOM.selectSingleNode("/my:myFields/my:JobNumber").text;
     try
     {
     var cn = new ActiveXObject("ADODB.Connection");
     var sqlSP ="EXEC dbo.uspJobAndContract ' " + jobNumber;
     
     cn.ConnectionString=XDocument.DataObjects("JobData").QueryAdapter.Connection;
     cn.ConnectionTimeout=XDocument.DataObjects("JobData").QueryAdapter.Timeout;
     
     cn.Open();
     cn.Execute(sqlSP);
     cn.Close();
     
     eventObj.ReturnStatus=true;
     }
     
     catch(e)
     {
     XDocument.UI.alert(e.description);
     eventObj.ReturnStatus = false;
     }
    }

    Dean
    Charlotte, NC
  • 10-03-2008 11:17 AM In reply to

    Re: Error Message: Undeclared Namespace

    Hi:

    When we add an event to an InfoPath form, when working with jscript, IP will add the namespace definition at the top of the .js file. For example:

    XDocument.DOM.setProperty("SelectionNamespaces", 'xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2008-10-03T18:12:27"');

    Since you are getting an undeclared namespace error, I'm wondering if that was somehow erased or removed from you .js file. Could you check and see?

    Hilary Stoupa

  • 10-07-2008 07:09 AM In reply to

    Re: Error Message: Undeclared Namespace

    Hilary, thanks for the tip. You were correct, I have added the namespace definition to the top of the js file and the undeclared namespace error is gone, but now I am getting an "Object doesn't support this property or method error"  on the following line:

     XDocument.UI.alert(e.description);

    Any idea what could be wrong with this? i am using IP 2007 and saving as 2003.

    TIA
    Dean

    Dean
    Charlotte, NC
  • 10-07-2008 07:27 AM In reply to

    Re: Error Message: Undeclared Namespace

    My first guess is that the Alert method should be capitalized.....

    Hilary Stoupa

  • 10-07-2008 07:35 AM In reply to

    Re: Error Message: Undeclared Namespace

    You were correct, thanks

    Dean
    Charlotte, NC
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.