How to add a space between two fields

Community Beginner ,
Sep 16, 2022 Sep 16, 2022

Copy link to clipboard

Copied

Hello,

I have a script that will attach a completed form in an email, and include the user's name in the subject line. The problem I am having is that there is no space between the first and last name, which makes sense given the code: 

cSubject: "Travel authorization form for" + this. getField("text1").valueAsString+this.getField("text2").valueAsString 

How do I add a space in between the two fields (Text1 is first name and Text2 is last name)?

TOPICS
JavaScript

Views

30

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 16, 2022 Sep 16, 2022

You need to add an empty string using empty space in between quotation marks (i.e.  " ").

 

Change your current script like this:

 

 

cSubject: "Travel authorization form for " + this. getField("Text1").valueAsString + " " + this.getField("Text2").valueAsString 

 

 

 

Likes

Translate

Translate
Community Expert ,
Sep 16, 2022 Sep 16, 2022

Copy link to clipboard

Copied

You need to add an empty string using empty space in between quotation marks (i.e.  " ").

 

Change your current script like this:

 

 

cSubject: "Travel authorization form for " + this. getField("Text1").valueAsString + " " + this.getField("Text2").valueAsString 

 

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 16, 2022 Sep 16, 2022

Copy link to clipboard

Copied

ls_rbls,

 

Thank you so much. As I was telling Try67, I used your template from another solution posted here to customize a script. Small world. 

 

Ki

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 16, 2022 Sep 16, 2022

Copy link to clipboard

Copied

LATEST

You're very welcome.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

Make content for your business needs with Adobe Express.

Get started easily with free templates: