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 / February 2007

Tip: Looking for answers? Try searching our database.

OnSaveRequest stringObj.replace();

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kookie - 14 Feb 2007 15:19 GMT
I am using several form fields to name my file on save. the fields contain
blank spaces. I want to remove these space, but i cant figure out the syntax.
I have tried
replace(" ", "");
replace(/\'/g, "''");
replace(/'/g, "''");

Please help!
kookie - 14 Feb 2007 20:22 GMT
You look hard and long enough eventually you figure it out. here is the
solution.

var strMnPName =
XDocument.DOM.selectSingleNode("/my:myFields/my:MnPName").text;
   var strRegion =
XDocument.DOM.selectSingleNode("/my:myFields/my:Region").text;
   var strRole = XDocument.DOM.selectSingleNode("/my:myFields/my:Role").text;
   
   var blank = " ";
   //strMnPName = strMnPName.replace(blank,""); // this only removed the
first space
   
   var nameSum = countSpaces(strMnPName); // by counting spaces I was able
to remove all
        for(var icount = 0; icount < nameSum; icount++) {
        strMnPName = strMnPName.replace(blank,"");

        }
    var roleSum = countSpaces(strRole);
        for(var icount = 0; icount < roleSum; icount++) {
        strRole = strRole.replace(blank,"");

        }
      //XDocument.UI.Alert(countSpaces(strMnPName));
   
   
   var strURI = XDocument.Solution.URI; //template path
   var strFormLib = strURI.substr(0, strURI.indexOf("Forms/template.xsn"));
                           
   if (XDocument.IsNew == true || eventObj.IsSaveAs == false)
   {
       if (eventObj.IsSaveAs == true)
       {
           XDocument.UI.SetSaveAsDialogLocation(strFormLib);
           XDocument.UI.SetSaveAsDialogFileName(strMnPName + "_" +
strRegion + "_" + strRole);
       }
       eventObj.IsCancelled = eventObj.PerformSaveOperation();
       eventObj.ReturnStatus = true;
   }

> I am using several form fields to name my file on save. the fields contain
> blank spaces. I want to remove these space, but i cant figure out the syntax.
[quoted text clipped - 4 lines]
>
> Please help!
 
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.