Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to add a space between two fields

Community Beginner ,
Sep 16, 2022 Sep 16, 2022

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
825
Translate
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
1 ACCEPTED SOLUTION
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 

 

 

 

View solution in original post

Translate
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

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 

 

 

 

Translate
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

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

Translate
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
LATEST

You're very welcome.

Translate
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