Expand my Community achievements bar.

email showing "null"

Avatar

Level 1

Hi everyone,

I am using the following script attached to a button on my form:

var cCCAddr = "fsxxxxx@xxx.org; bxxxx@xxxxxx.org";

var cSubLine = "Home leave request-" + Name.rawValue + ", " + country.rawValue + ", " + City.rawValue + "-" + cdsub.rawValue;

var cBody = "Dear Mrs O'XXXX,\n" + " \n"

+ "Please find attached my home leave request for your approval and consideration. \n" + " \n"

+ "Destination:    " + country.rawValue + ", " + City.rawValue + " \n" + " \n"

+ "Travellers and dates: "

+ Name.rawValue + " (Staff ) - " + "from: " + Start_Date1.rawValue + " - " + "To: " + End_Date1.rawValue + " - " + "Number of days: " + TotalDays.rawValue + " \n" + " \n"  

+ Name1.rawValue +  " " + Relationship1.rawValue +  "    " + Start_Date2.rawValue +  "    " + End_Date2.rawValue + " \n" 

+ Name2.rawValue +  " " + Relationship2.rawValue +  "    " + Start_Date3.rawValue +  "    " + End_Date3.rawValue + " \n" 

+ Name3.rawValue +  " " + Relationship3.rawValue +  "    " + Start_Date4.rawValue +  "    " + End_Date4.rawValue + " \n" 

+ Name4.rawValue +  " " + Relationship4.rawValue +  "    " + Start_Date5.rawValue +  "    " + End_Date5.rawValue + " \n" + " \n"

+ "The budget line is as follows:  " + WBS.rawValue + "\n" + "\n"

+ "Lump Sum :  " + Yes.rawValue + "\n" + " \n"

+ "Comments :  " + Comments.rawValue + "\n" + "\n"

+ "Kind regards,\n" + "\n"

+  Name.rawValue;

            

var cEmailURL = "mailto:fXXXXX@XXXX.org?cc=" + cCCAddr + "&subject=" + cSubLine + "&body=" + cBody;

event.target.submitForm({

    cURL: cEmailURL,

    cSubmitAs:"PDF",

    cCharSet:"utf-8"

    });

It works great unless nothing is entered into any of the fields (Name1.rawValue, Name2.rawValue, Relationship1.rawValue etc..) Then the email client shows "null". 

I t is driving me crazy, i do not much about scripting and have been looking for hours on the internet...with any success, any help would be greatly appreciated..

Sorry for being so wordy.  Thank you so much in advance for any assistance.

2 Replies

Avatar

Level 10

Hi,

I've tried your code by replacing cSubLine and cBody vars by a simple string and it worked fine here...

I suggest you make messageBox for each var you are passing through the submitForm

xfa.host.messageBox(cCCAddr);

xfa.host.messageBox(cSubLine);

xfa.host.messageBox(cBody);

then now take a look at those variables and see if there's something wrong.

Good luck!

Avatar

Level 1

Thank you Magus,

But I do not know how to do what you are telling me.

If it is not much trouble , would you be more specific

Thank you very much in advance