onSubmitRequest event handler

A

andrew_mcnaney

Hi

I am very new to infopath 2003 and xsn forms. I have modified an
existing application however I get the following error :

InfoPath cannot submit the form.
The onSubmitRequest event handler returned a value indicating that the
submit failed.


The submit script is as follows :

/*
* This file contains functions for data validation and form-level
events.
* Because the functions are referenced in the form definition (.xsf)
file,
* it is recommended that you do not modify the name of the function,
* or the name and number of arguments.
*
*/

// The following line is created by Microsoft InfoPath to define the
prefixes
// for all the known namespaces in the main XML data file.
// Any modification to the form files made outside of InfoPath
// will not be automatically updated.
//<namespacesDefinition>
XDocument.DOM.setProperty("SelectionNamespaces",
'xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2003-04-20T21:29:06"');
//</namespacesDefinition>


//=======
// The following function handler is created by Microsoft InfoPath.
// Do not modify the name of the function, or the name and number of
arguments.
//=======
function XDocument::OnSubmitRequest(eventObj)
{
// If the submit operation is successful, set
// eventObj.ReturnStatus = true
// Write your code here
try
{
var objXH = new ActiveXObject("MSXML2.XMLHTTP.3.0");
}
catch(exception)
{
XDocument.UI.Alert("Could not create MSXML2.XMLHTTP.3.0 object.\r\n"
+
exception.number + " - " + exception.description);
eventObj.ReturnStatus = false;
return;
}


try
{
objXH.open("POST",
"http://darla:1966/DataService.asmx/InsertRequest", false);
objXH.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded");
strPostXMLText = XDocument.DOM.xml;

strPostXMLText = strPostXMLText.replace(/\+/g, "%2B");
strPostXMLText = strPostXMLText.replace(/\&/g, "%26");

//XDocument.UI.Alert(strPostXMLText);

objXH.send("TimeOffDetailsXML=" + strPostXMLText);

if(objXH.status != 200)
{
XDocument.UI.Alert("Failed while sending the request.\r\n" +
objXH.status + " - " +
objXH.statusText);

eventObj.ReturnStatus = false;
return;
}
}
catch(exception)
{
XDocument.UI.Alert("Failed while sending the request.\r\n" +
exception.number + " - " +
exception.description);
eventObj.ReturnStatus = false;
return;
}

eventObj.ReturnStatus = true;
return;
}








Can anyone see whats going wrong?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top