DataConnection not defined error - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

DataConnection not defined error

Last post 07-08-2009 08:44 AM by Danielle. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 07-07-2009 02:00 PM

    • Danielle
    • Not Ranked
      Female
    • Joined on 02-17-2009
    • North Carolina
    • Posts 12

    DataConnection not defined error

    Hi guys,

    I am still struggling with a timeout error due to a slow network on my 2003 form.  I have come up with the below code (never written code in Jscript before) and now I am getting an error, Data Connection not defined.

     Can anyone tell me what lines I am missing?

    XDocument.QueryAdapter.Timeout=120;

    XDocument.QueryAdapter.Submit();

    DataConnection.spConn=DataConnections["Submit"];

    spConn.Execute();

    Danielle
  • 07-07-2009 04:33 PM In reply to

    • Danielle
    • Not Ranked
      Female
    • Joined on 02-17-2009
    • North Carolina
    • Posts 12

    Re: DataConnection not defined error

    Ok Guys, getting closer...  I have the submit working, now I need to get it to close the form and give a success/failure message... HELP..

    XDocument.QueryAdapter.Timeout=120;

    XDocument.QueryAdapter.Submit();

    XDocument.DataAdapters["Submit"].Submit();

    XDocument.UI.Alert("The form was submitted successfully.");

     

    Danielle
  • 07-07-2009 05:44 PM In reply to

    • Danielle
    • Not Ranked
      Female
    • Joined on 02-17-2009
    • North Carolina
    • Posts 12

    Re: DataConnection not defined error

    OK, this code gets it to go to both connections, but it comes up and says it failed.  So I still need that sucess fail code I guess, any ideas?

     XDocument.QueryAdapter.Timeout=120;

    XDocument.QueryAdapter.Submit();

    XDocument.DataAdapters["MainConnection"]

    XDocument.DataAdapters["Submit"] .Submit();

     

    Danielle
  • 07-07-2009 05:48 PM In reply to

    Re: DataConnection not defined error

    I'm a little confused by the query adapter and what it is doing? I can see that you have the submit adapter and are using it to submit the form, but the query adapter is the one you are setting the timeout on?

    I'm kind of javascript impaired, but I think you can close the form with XDocument.CloseDocument().

    Hilary Stoupa

  • 07-07-2009 05:57 PM In reply to

    • Danielle
    • Not Ranked
      Female
    • Joined on 02-17-2009
    • North Carolina
    • Posts 12

    Re: DataConnection not defined error

    Hi,  Thank you for responding,

    We are having network problems and have many remote users so they were getting timeout error.  I was told the only way to correct this was with code to change the timeout setting on submit.  Our SharePoint adminstrators would not budge on changing it on their level.   When I tried DataAdapter there, I got an error, QueryAdapter works and I don't get the timeout errors.  The code is working now except saying it failed, when it really didn't.

    I put in your line and got the error:

    InfoPath cannot submit the form.
    The onSubmitRequest event handler did not work.
    The following error occurred:

    Object doesn't support this property or method
    File:script.js
    Line:64

     Any ideas?

     Many Thanks!

    Danielle
  • 07-08-2009 08:32 AM In reply to

    Re: DataConnection not defined error

    I don't know what is on line 64 of your jscript file -- which is what the error is on. Like I said, CloseDocument() was a guess based on the MSDN docs. It could be wrong.

    MSDN labs show this code snippet:

       // Tell InfoPath the submit was successful.
       eventObj.ReturnStatus = true;

    Hilary Stoupa

  • 07-08-2009 08:44 AM In reply to

    • Danielle
    • Not Ranked
      Female
    • Joined on 02-17-2009
    • North Carolina
    • Posts 12

    Re: DataConnection not defined error

    Good Morning,

     I have finally got it working with the code below.  Thanks for all your help!

    function CTRL2114_7::OnClick(eventObj)

    { try { XDocument.QueryAdapter.Timeout=240;

    XDocument.QueryAdapter.Submit();

    XDocument.DataAdapters["MainConnection"]

    XDocument.DataAdapters["Submit"] .Submit();

    XDocument.UI.Alert("Document submitted successfully.");

    eventObj.ReturnStatus = true;

    XDocument.SetDirty(false);

    XDocument.View.Window.Close(true); }

    catch(ex)

    { XDocument.UI.Alert(ex.description);

    eventObj.ReturnStatus = false; } }

    Danielle
Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.