How to pull first character from string and concatenate into text string?
I have a form that is required to be filled out on a daily basis. At the end of the day, it is submitted to an email address (submission@example.com). The email subject line must be in the following format: 06.29.2020.Lastname, F
I have three form fields: Date, First and Last. Date is obvious. First is a user's full first name, Last is a user's full last name. My goal is to pull the entire string from Last but only the first character from First.
I have the following code in a Submit button on the form:
this.mailDoc({cTo: "submission@example.com", cSubject: this.getField("Date").valueAsString + "." + this.getField("Last").valueAsString + ", " + this.getField("First").valueAsString, cMsg: "Attached is blah blah blah for " + this.getField("Date").valueAsString + "."});
Currently this will print out "6.29.2020.Last, First"
I know I need to modify the "this.getField("First").valueAsString" portion, but I don't know how.
I've tried:
this.getField("First").charAt(0)
this.getField("First").substring(0,1)
and a number of other ugly variations of random things.
Can anyone help me modify this line to pull just the first character from "First"?
BONUS QUESTION:
The "Date" field currently prints the date in the format of m.d.yyyy.
The subject line format wants the date in the format of mm.dd.yyyy.
Is there a way to modify the date used for just this purpose? Or is there a different function I can use to generate a new date format instead of relying on the "Date" field?
[For the purposes of this question, modification of the "Date" field to print the format mm.dd.yyyy is not a feasible solution.]
