Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / June 2008

Tip: Looking for answers? Try searching our database.

Default File Name using Field Name

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Delnang - 24 Mar 2008 19:12 GMT
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

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.