Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Submitt email - Null in empty field in the body message

fernandosl38
Level 1
Level 1

Hi Everyone,

I am trying to create a form for my organization travels, staff needs to fill a form which it will go attached to an email and all the information filled in would appear in the email body. I have managed all that; however, if they leave any input field blank the word "null" appears in the email body. Allso, if all the values  in the var cFirst are null, I would like it to be hidden in the body's email.

I do not know much about Java and I have tried and looked for days on how to solve this problem without any luck.

I would be very gratefull any help that I could get to achive it  and I am really sorry for the long message, but I am desperate.

thank you very much in advance

var cCCAddr = "xxxx@CCC.org; Occc@CCC.org";
var cSubLine = "Home leave request - " + Name.rawValue + ",  " + country.rawValue + ",  " + City.rawValue + " - " + cdsub.rawValue;
var cFirst = "First:  " + Name1.rawValue +  Relationship1.rawValue + ";   " + "from: " + Start_Date1.rawValue + " - " + "To: " + End_Date1.rawValue + ";   " + "No days:" + TotalDays1.rawValue + " \n";
var cSecond = "Second: " + Name2.rawValue + Relationship2.rawValue + "; " + "from: " + Start_Date2.rawValue + " - " + "To: " + End_Date2.rawValue + "; " + "No days:" + TotalDays2.rawValue + " \n";
var cThird = "Third:  " + Name3.rawValue +  Relationship3.rawValue + ";   " + "from: " + Start_Date3.rawValue + " - " + "To: " + End_Date3.rawValue + ";   " + "No days:" + TotalDays3.rawValue + " \n";
var cFourth = "Forth:  " + Name4.rawValue +  Relationship4.rawValue + ";   " + "from: " + Start_Date4.rawValue + " - " + "To: " + End_Date4.rawValue + ";   " + "No days:" + TotalDays4.rawValue + " \n";
var cFifth = "Fifth:  " + Name5.rawValue +  Relationship5.rawValue + "  ; " + "from: " + Start_Date5.rawValue + " - " + "To: " + End_Date5.rawValue + ";   " + "No days:" + TotalDays5.rawValue + " \n";
var cBody = "Dear Mrs O'Neil,\n" + " \n"

+ "Please find attached my home leave request for your consideration and approval. \n" + " \n"
+ "Destination:    " + country.rawValue + ", " + City.rawValue + " \n" + " \n"
+ "Traveller(s) and date(s): "
+ Name.rawValue + " (Staff );  " + "from: " + Start_Date.rawValue + " - " + "To: " + End_Date.rawValue + ";   " + "Number of days: " + TotalDays.rawValue + " \n" + " \n";  
var cBody2 = "\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:rrrr.org?cc=" + cCCAddr + "&subject=" + cSubLine + "&body=" + cBody + cFirst + cSecond + cThird + cFourth + cFifth + cBody
event.target.submitForm({
    cURL: cEmailURL,
    cSubmitAs:"PDF",
    cCharSet:"utf-8"
    });

RESULT :

Dear Mrs CCC

Please find attached my home leave request for your consideration and approval.

Destination:   Algeria, London

Traveller(s) and date(s):  James doe (Staff );  from: 2014-08-06 - To: 2014-08-14;   Number of days: 9

First: nullnull;   from: null - To: null;   No days:null

Second: nullnull;  from: null - To: null;   No days:null

Third: nullnull;   from: null - To:null;   No days:null

Forth: nullnull;   from: null - To:null;   No days:null

Fifth:nullnull  ; from: null - To:null;   No days:null

The budget line is as follows:  GF/2014-07-01-03 - 1000CDY03

Lump Sum :  Yes, Iwould like to avail myself of the lump sum option

Comments:   None

Kind regards,

James doe

DESIRE RESULT

Traveller(s) and date(s):  James doe (Staff );  from: 2014-08-06 - To: 2014-08-14;   Number of days: 9

First: nullnull;   from: null - To: null;   No days:null

Second: nullnull;  from: null - To: null;   No days:null

Third: nullnull;   from: null - To:null;   No days:null

Forth: nullnull;   from: null - To:null;   No days: n/a  (if any value null)

Fifth:nullnull  ; from: null - To:null;   No days:null - if all null = hidden

The budget line is as follows:  GF/2014-07-01-03 - 1000CDY03

Lump Sum :  Yes, I would like to avail myself of the lump sum option

Comments:   None

Kind regards,

James doe

0 Replies