I have a field in my data source called FileName which is a concat of two
other fields. I want to use FileName as the default filename and have the
following Code in the Save code in the Form Options:
function XDocument::OnSaveRequest(eventObj)
{
var filePath = "file:///C:/";
var fileName =
XDocument.DOM.selectSingleNode("my:myFields/my:FileName").text;
XDocument.UI.SetSaveAsDialogFileName(fileName);
XDocument.UI.SetSaveAsDialogLocation(filePath);
eventObj.IsCancelled = eventObj.PerformSaveOperation();
if (eventObj.IsCancelled)
{
XDocument.UI.Alert("Save Cancelled");
}
else
{
XDocument.UI.Alert("Form saved");
}
eventObj.ReturnStatus = true;
}
I am using Jscript, InfoPath 2003 with SP2 - the error is:
The following error occurred:
Reference to undeclared namespace prefix: 'my'.
File:script.js
Line:4
Unspecified error
What am I doing wrong? Any suggestions?
Thanks,
Angie
Gavin McKay - 25 Mar 2008 10:05 GMT
Hello,
I can't advise on JavaScript, but in the .NET world that error means the xml
document does not understand the "my:" namespace. Either try it without
using the namespace:
"my:myFields/my:FileName"
or if that doesn't work you need to find a way to add the "my:" namespace so
that selectSingleNode understands what to do with it.
HTH
Gavin.
> I have a field in my data source called FileName which is a concat of two
> other fields. I want to use FileName as the default filename and have the
[quoted text clipped - 33 lines]
> Thanks,
> Angie
Shekar - 21 Jun 2008 10:29 GMT
Hi
Check in your script.js file has the following line of code:
XDocument.DOM.setProperty("SelectionNamespaces", "< Here the form name
space>");
if not you need to set the name space property.
Hope this helps you.

Signature
Shekar.Y
http://www.ggktech.com
> I have a field in my data source called FileName which is a concat of two
> other fields. I want to use FileName as the default filename and have the
[quoted text clipped - 33 lines]
> Thanks,
> Angie